I’m having trouble wrapping my head around this one. I have a little snippet wherein I will play an animation, have it wait for a second or two after the animation is complete, and then repeat the process. I’d figured it would have to work like this but I guess I’d figured wrong.
Here is the code exactly as it written. I would appreciate any help at all on this. Thank you very much in advance.
var x : float;
function Update(){
Animate();
}
function Animate() {
animation.Play("Take 001");
yield WaitForSeconds(x);
}
So yielding… you can think of it like placing a book mark to come back to for a later time(execution), when you call yield, everything happens after the yield(including after the Animate() function call in update) when yielding. In your case you would be playing an animation every single frame, i’m sure the animation doesn’t even complete.
var x : float;
function Update(){
Animate();
}
function Animate() {
// If the named animation is not playing, play it.
if (animation.IsPlaying("Take 001") == false) {
animation.Play("Take 001");
};
//yield WaitForSeconds(x);
}
Thank you to both of you for your responses! Makes more sense than the documentation I found. I will get on implementing this immediately.
Again, thank you for your time and consideration.