- Home /
Anyone could explain for me "Animator.GetCurrentAnimatorStateInfo(x)" command ?
Okey, i understand that this piece of code get the state of the animator, but i dont understand why he uses the parameter ? I have to pass a Layer Index in the parameter for what ?
I hate just ctrl+c ctrl+v. I need to KNOW.
Thx <3
btw, i dont find anything about it in the Unity Documentation. Just this: https://docs.unity3d.com/ScriptReference/Animator.GetCurrentAnimatorStateInfo.html So...
Answer by waqar92 · Nov 01, 2017 at 11:11 AM
Layer Index is actually the index of Layer in Animator Tab . Base Layer is default in Animator which is counted as 0 as an Layer Index. If you have more Layers then add up the indexes according to that .
Answer by TanselAltinel · Nov 01, 2017 at 07:59 AM
It uses the parameter to get the layer information. An avatar is able to player more than one animation at a given time, but those animations must be on different layers and sometimes you need to know a specific layer's state to proceed the logic.
More info about Animation Layers: https://docs.unity3d.com/Manual/AnimationLayers.html
Tutorial about Animation Layers: https://unity3d.com/learn/tutorials/topics/animation/animator-controller-layers