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 我试过了 play.GetCurrentAnimatorClipInfo(0).clip.name
但它却抛出了一个错误。
'AnimatorClipInfo[]' does not contain a definition for 'clip'
这是因为你在访问数组。GetCurrentAnimatorClipInfo(0)返回一个数组。你需要访问数组元素来获取信息,像这样。
play.GetCurrentAnimatorClipInfo(0)[0].clip.name