Sebastian Scholl
Published

AtlasVR: Connecting to Web API's in Unity for Weather Data

Wondrous escapism can be experienced creating VR. Yet having real world data effect our VR environments is essential. Here's how to do it.

IntermediateFull instructions provided3 hours2,804
AtlasVR: Connecting to Web API's in Unity for Weather Data

Things used in this project

Hardware components

Gear VR
Oculus Gear VR
×1

Software apps and online services

Unity
Unity
Blender

Story

Read more

Custom parts and enclosures

Landscape Mesh

Low poly OBJ made in Blender to use in our unity scene.

Schematics

Unity Project

Unity package to import into new Project

Code

WebAPIScript

C#
using UnityEngine;
using System.Collections;

public class WeatherAPI : MonoBehaviour {
	public string url = "http://api.openweathermap.org/data/2.5/weather?lat=35&lon=139&<YOUR API KEY>";

	// Use this for initialization
	IEnumerator Start () {
		WWW request = new WWW(url);
		yield return request;

		if (request.error == null || request.error == "") 
		{
			Debug.log(request.text);
		} 
		else 
		{
			Debug.Log("Error: " + request.error);
		}
	}

	// Update is called once per frame
	void Update () {
	}
}

Credits

Sebastian Scholl

Sebastian Scholl

1 project • 0 followers
An open source personality.

Comments