Hey guys,
I’m new to unity and programming and I’m having some issues I hope you guys can help me with.
I’m trying to create a delay before starting the Update function (is it even possible?). The script is for my character movement and I want there to be a slight delay before the user can start to move the character. This is what I have so far:
Sorry I had problems putting the Code in here so i took a picture.
So basically I want to make a short delay - maybe 2-3 seconds in which the player cant control the character. If there is any way I can accomplish this please help me out!
Thanks in advance!
float time = 3.0f;
void Update () {
if(time >= 0){
time -= Time.deltaTime;
return;
}else{
//Do Something after clock hits 0
}
//Do Something else while clock counting down
}
Inok
3
For delay in code execution better use coroutines Coroutines
Learn them and you will not want to back to primitive timers in update.