using System.Collections; using System.Collections.Generic; using UnityEngine; public class AIM : MonoBehaviour { public Animator play; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { //Debug.Log(play.GetCurrentAnimatorClipInfo(0).clip.name); } }
Animator.GetCurrentAnimatorClipInfo I попробовал play.GetCurrentAnimatorClipInfo(0).clip.name, но выдает ошибку:
play.GetCurrentAnimatorClipInfo(0).clip.name
'AnimatorClipInfo[]' does not contain a definition for 'clip'
Это потому, что вы обращаетесь к массиву. GetCurrentAnimatorClipInfo (0) возвращает массив. Вам нужно получить доступ к элементу массива, чтобы получить информацию, например:
play.GetCurrentAnimatorClipInfo(0)[0].clip.name