using System; using UnityEngine; namespace Framework.Actors { /// Contains helper methods for working with Mecanim animators public static class AnimatorHelper { /// Determines the index of the layer with the specified name /// Name of the layer whose index will be determined /// The index of the layer with the specified name public static int GetLayerIndex(Animator animator, string name) { for(int index = 0; index < animator.layerCount; ++index) { string layerName = animator.GetLayerName(index); bool ignoreCase = true; if(string.Compare(layerName, name, ignoreCase) == 0) { return index; } } return -1; } } } // namespace Framework.Actors