I’m trying to make my rain particle turn on and off randomly. Not having a terrible amount of coding experience (at least in this department) it’s been difficult so far, and with Unity Answers being down (for me at least) I figured I’d ask here. Here’s my code so far, which is a mess.
the best function for this is rnd()
Elaborate?
function Start () {
while (true){
yield WaitForSeconds(Random.Range(2.0, 10.0)); // Random delay between 2 and 10 seconds
rain.active = !rain.active; // Flip the active state
yield; // Not sure, this may be yield null in UnityScript
}
}
Very relevant documentation:
http://docs.unity3d.com/Documentation//ScriptReference/index.Coroutines_26_Yield.html
Thank you very much, very useful. ![]()