Unisky realisitc day night cycle + random weather

anyone who got a script that will do as written above? make unisky have a really nice random weather and day night cycle? what i got this far is

using UnityEngine;
using System.Collections;

public class ExampleScript : MonoBehaviour {

// create an instance of the API
private UniSkyAPI uniSky;

void Start() {

// define the instance
uniSky = GameObject.Find("UniSkyAPI").GetComponent("UniSkyAPI") as UniSkyAPI;

// instantiate 
uniSky.InstantiateUniSky();
}

void Update() {

// set up a 24-hour cycle with a framerate dependent speed of 1.0
uniSky.SetTime(uniSky.GetTime() + Time.deltaTime * 1.0f);
	}
}

thanks alot in advance

using UnityEngine;
using System.Collections;

public class UniskyGameTime : MonoBehaviour {
	
	// instance of the API
	private UniSkyAPI uniSky;
	
	public float dayCycleInMinutes = 1; //How many minutes in real time a game day will pass
	
	
	private float _dayCycleInSeconds; 
	
	private const float SECOND = 1;
	private const float MINUTE = 60  * SECOND;
	private const float HOUR = 60 * MINUTE;
	private const float DAY = 24 * HOUR;
	
	
	
	private float _dayPercent = 0;
	
	private float _timeOfDay;
	

	// Use this for initialization
	void Awake () {
		
		
		_dayCycleInSeconds = dayCycleInMinutes * MINUTE;
		
		
		
		// Define instance
		uniSky = GameObject.Find("UniSkyAPI").GetComponent("UniSkyAPI") as UniSkyAPI;
		
		// Initiate and create default UniSky 
		uniSky.InstantiateUniSky();
		
		// Set some initial states 
		uniSky.SetTime(12.0f);
		uniSky.SetAmbientLighting(new Color(0.1f, 0.1f, 0.1f, 0.1f));
		uniSky.SetStormCenter(new Vector3(0,0,0));
		uniSky.SetSunShadows(LightShadows.Soft);
		
		}
		

		
	
	
	// Update is called once per frame
	void Update () {
		
		_timeOfDay += Time.deltaTime;
		_dayPercent = _timeOfDay / _dayCycleInSeconds * 24;
		if (_timeOfDay > _dayCycleInSeconds)
		{
		
			_timeOfDay -= _dayCycleInSeconds;
		}
		uniSky.SetTime(_dayPercent);
		
		Debug.Log(_timeOfDay);
		
		
	}
}

Here’s a start for you. It allows you to control how long your in game days in real time minutes. It changes from day to night accordingly starting at midnight. I’m trying to develop a dynamic script that would have random storms occur and change cloud coverage randomly on some days and durring the day. If anyone else has any suggestions or example code or ways of optimizing what i did please comment.

hi my friend this works really well. i have a question, how can i make it start from the day

This is really old, but I have a more efficient way of doing this (still don’t know how to make it start at a given time). Here’s what you need to add to allow the time to continue to cycle. The only downside is that for one frame the time is the same.

After the line in the Update function in the code in the OP, add an if statement like this:

if(uniSky.GetTime() > 24)
{
uniSky.SetTime(0);
}

And it will cycle through a day, instead of stopping at night.