T
T
TheTalion2017-09-24 14:50:22
Unity
TheTalion, 2017-09-24 14:50:22

How to get currently playing animation from Animator?

Tried to do like this:

animator.Play ("Create");
                var hash = Animator.StringToHash ("Base Layer.Create");
                var state = animator.GetCurrentAnimatorStateInfo(0);
                while (state.fullPathHash == hash) {//тут false
                        Debug.Log ("1111");
                }

I also tried to bring the string to the hash without the Base Layer, but still not the right way.
The controller itself:
fc74a65e606d656d09021cb02831b17b-full.jp
What am I doing wrong? Or is it possible to do it all somehow easier, with understandable structures without hashes?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Gaydak, 2017-09-24
@TheTalion

You have already been answered with a comment, but if you fly there, read it to people for the future.
in theory, everything is banal. you thought that you had a "Base Layer" layer, but in fact you just have it "Base".
therefore, the line in the code should also be
var hash = Animator.StringToHash ("Base.Create");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question