Does anyone know a good way I can call a function every two seconds so I can control the speed at which I my Ball objects across the screen.
I already have a function to instantiate the objects I just need a way to call it at specified time intervals , is it possible to make these values a little varied using something like Random.Range?
private var gapTest = true;
function Update () {
if (gapTest) {
// do your stuff here option 1
GapSet ();
}
}
function GapSet () {
gapTest = false;
// do your stuff here option 2
yield WaitForSeconds (2);
gapTest = true;
}