Hello, I was just wondering.
Is there a way to call a function each second instead of 60x a second,like function Update() does.
I have tried to put a yield each time after it calls the function but that doesn’t work either.
Well this is the script I made. Each time (or 60x a second because of Update().) it picks a random number ranged from 0 to 4. “Spawn” is equal to that number that has been chosen.
This all works well only it Updates way to fast. I tried to put a “yield WaitForSeconds(1);”. With no succes.
function Update()
{
var Spawn = Random.Range(0,4);
if(Spawn == 0){
Debug.Log("spawn0");
}
if(Spawn == 1){
Debug.Log("spawn1");
}
if(Spawn == 2){
Debug.Log("spawn2");
}
if(Spawn == 3){
Debug.Log("spawn3");
}
if(Spawn == 4){
Debug.Log("spawn4");
}
}
Thanks for reading.