|
I have a main menu which has a 3 second transition in, which looks cool and all, but I ran into a problem - I can mouseover the objects during their transition in, which I don't want to be able to do. So I used a yield WaitForSeconds(3) before the function OnMouseOver, thinking that would solve it: But it didn't appear to create any sort of delay, and the problem still existed. Is there another way to force this delay before a function without putting a delay within the function itself?
(comments are locked)
|
|
Forget the yield. Check how long the game has been running instead. It also appears you yield outside of any function? That does.. nothing. The reason the iTeen functions work is because you're starting coroutines.
Jul 10 '11 at 05:06 PM
Joshua
Thanks - that solved it. And yes, I have no idea what I'm doing sometimes. I kind of just assumed if one thing worked outside of a function, anything would.
Jul 10 '11 at 05:13 PM
playbass06
We've all been there at some point. ;) Functions are executed when they are called. The update function is called once every frame. The OnMouseOver function is called every frame when the mouse is over the collider. Variables declared outside of functions are global variables, and can then be used inside those functions. If you call a function outside of any function you're calling a coroutine at start. This is actually not good practice, it's better to put them in the Start function, which will then call them at start.
Jul 10 '11 at 05:27 PM
Joshua
(comments are locked)
|
