time delay between 2 action

hello,

i try to make a few delay between 2 actions:

First action:
player clic on a GUI button thaht active an animation and sound.

second action:
after a few time, engine launch level 1.

i don’t know how to make time…
here is my code :

another way could be the possibility to create switch ?

Have a look at coroutines in the reference manual. It does exactly what you want :slight_smile:

when i was young, i learning a little Basic code…

i just remembered that little order “GOTO line 30”
witch authorize prog to jump to line 30 for exemple.

i that any way to make something similar in java ?

try the Invoke function.

U can drop the GOTO idea in javascript or other oriented object programming language, it’s more like GOSUB…

Example from the documentation on co-routines:

// Prints 0
print (Time.time);
// Waits 5 seconds
yield new WaitForSeconds (5);
// Prints 5.0
print (Time.time);