4
\$\begingroup\$

I have a very simple animation parameter in the Animator, a boolean that is "true" when a shooting animation is playing (to stop the game logic from allowing more shooting during a gun recoil animation). I assumed I'd be able to access this in animations, i.e. setting it to true when a shooting animation started, and false when it ended. But I just can't see how to access it in my animations. It's not available under "Add Curve". Am I missing something?

I can do this in other ways, but this just seemed like the cleanest.

Screenshot of animation parameter setup

\$\endgroup\$
  • \$\begingroup\$ Have you tried creating a state that you transition to every time Shooting is set to true? \$\endgroup\$ – pek Mar 30 '14 at 17:27
1
\$\begingroup\$

AFAIK, yes, the parameters can only be changed via scripts. To stop the game logic from allowing more shooting, you should NOT be making a parameter here. The Animator doesn't need to know anything about that, it only cares about animation blending and transitions.

Make a private boolean variable in the script that actually triggers the shooting and don't trigger the shooting when (e.g.:) _isShooting is set to true. You can use something like a coroutine to make a set delay.

Animator parameters exist to enable transitions, that's all they do.

\$\endgroup\$

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.