Version: 2020.3
public float length ;

描述

该动画剪辑的长度(以秒为单位)。

using UnityEngine;
using System.Collections;

public class ExampleScript : MonoBehaviour { public Animation anim;

void Start() { // Print the length of the walk animation in seconds print(anim["Walk"].length); } }