1
\$\begingroup\$

I've written a script to play an animation, but it starts immediately as my level loads. Instead, I want it only to start when triggered by some event or after a given timeout.

How can I do this?

\$\endgroup\$
2
\$\begingroup\$

Uncheck the "Play Automatically" checkbox in the Inspector (Animation section). Obviously make sure you select the appropriate GameObject or prefab first.

Then use animation.Play('yourAnimationName') in the appropriate event handler.

\$\endgroup\$
1
  • \$\begingroup\$ @gamenewdev Hello. I see that you have a few questions you've asked so far, but not accepted answers for. Remember to tick the checkmark next to the answer that helped you overcome your problem. And good luck with your game :) \$\endgroup\$
    – Engineer
    Apr 17 '14 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.