G
G
Geckyhit2017-01-31 16:41:21
Android
Geckyhit, 2017-01-31 16:41:21

Tracking current animation?

Hello, is it possible in unity3d (practically without crutches) to track whether a certain animation is currently running?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Basmanov, 2017-01-31
@Geckyhit

There are three options:
1. Create an event in the desired animation frame and hook the method there. A clumsy and inconvenient method, but as an option, if the animation is one and will not change. In the latest versions of the unit, they can even be added from the code , but I still would not advise running methods through lines.
2. Pull Animator.GetCurrentAnimatorStateInfo inside OnAnimatorMove . Not a super reliable method at low fps, short transitions can be skipped, but otherwise quite normal and suitable for synchronizing something with animation time. 3. Use StateMachineBehaviour . The most versatile and reliable way, if desired, classes can be initialized using
Animator.GetBehavior . Requires manual hanging of scripts on graph nodes, but this can be easily automated if desired.
Don't forget about the Animation component as well . It is poorly supported in recent versions, but at least the current animation is trivially determined.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question