True Weather

True Weather‘ gives you information about the weather conditions and the geolocation of the users of your games.



In order to start using ‘True Weather‘ the first thing you should do is create a new object in your scene and add the component ‘TrueWeather‘. There should be only one instance of that component.

Once added, you will see something like this in the editor:

In ‘Units‘ (1) you can change the metric system in which the units will be.

If ‘Try GPS first‘ (2) is activated, the geolocation service will first attempt to use the GPS hardware of the device. This is usually only available on mobile devices and the application will need permissions to use it. If this option is used and to save battery, the configuration is used with less precision (~ 500 meters) and is only active during detection.

If this option is not activated, or is not available, the web service provided by This service does not require registration for less than 1000 consultations per day. We recommend you register and look his payment service when your game is public. When you register, they will give you a key that you must put in ‘API Key‘ (3).

To obtain the meteorological data, the web service provided by will be used. This service does require you to register, even for your free service. You must register for the ‘Current weather data‘ service in the API section:

With the free service you can make up to 60 queries every hour. When you register, they will give you a key that you must put in ‘API Key‘ (4).

Are you interested in using another similar service? Do not hesitate to contact us.


All code is inside the namespace ‘Ibuprogames.TrueWeatherAsset‘ and main component is ‘TrueWeather‘. So if you want to use it you must first import its namespace:

using Ibuprogames.TrueWeatherAsset;

If you already created an object with the ‘TrueWeather‘ component, to access it:

TrueWeather trueWeather = FindObjectOfType<TrueWeather>();

To detect the current time you will first have to call the function ‘Detect()‘. As this information may take some time to be available, you can pass an Action as a parameter to know when it is ready. For example, if you want that when the information is available, your ‘ShowWeatherInfo()‘ function is called:

trueWeather.Detect((success, errorMsg) =>
  if (success == true)
    Debug.LogError($"Error: {errorMsg}");

Once the ‘Detect()‘ function returns you successfully, you can check the information using the properties ‘Location‘ (geolocation) and ‘Weather‘ (meteorological information):

float latitude = trueWeather.Location.Latitude;
float longitude = trueWeather.Location.Longitude;

string description = trueWeather.Weather.Description;
float temperature = trueWeather.Weather.Temperature;
float pressure = trueWeather.Weather.Presure;
float humifity = trueWeather.Weather.Humidity;
DateTime sunrise = trueWeather.Weather.Sunrise;
DateTime sunset = trueWeather.Weather.Sunset;

All this information will be available until the next time you call ‘Detect()‘.

Optionally, and if you have used the service (not the device GPS), you can access the extra information provided by this service:

if (trueWeather.Location is IPAPILocation)
  IPAPILocation ipAPILocation = (IPAPILocation)trueWeather.Location;

  string ip = ipAPILocation.IPAdress;
  string country = ipAPILocation.Country;
  string region = ipAPILocation.Region;
  string city = ipAPILocation.City;

All the code are well commented, I recommend reading the code if you want more information.

Any questions or suggestions you have, we will be happy to answer you in our mail:

You Might Also Like

No Comments

Leave a Reply