Is there a yield WaitForSeconds type code for the update? if not, what could i use?
Update() is your main game loop - the lifeblood of your game. It runs every frame and can’t be interrupted or paused. Suitable alternatives for yield WaitForSeconds really depend on what you’re trying to achieve, but, assuming it’s something like “Wait 5 seconds, then execute myfunction()”, then what you’re looking for is:
Invoke("myfunction", 5);
http://unity3d.com/learn/tutorials/modules/beginner/scripting/invoke
sry heres what i was looking for.
var timer : float = 0.0; // begins at this value
var timerMax : float = 3.0; // event occurs at this value
function Update()
{
timer += Time.deltaTime;
if (timer >= timerMax)
{
Debug.Log("timerMax reached ! put what you want to trigger in here.");
//or set a variable so you can put an if your variable jibberjabber
//somewhere else.
}
}