Version: 2017.2
public void Sample ();

描述

对当前状态的动画进行采样。

当您明确要设置某种动画状态并对其进行一次采样时,这非常有用。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Animation anim; void Start() { anim = GetComponent<Animation>(); anim["MyClip"].time = 2.0F; anim["MyClip"].enabled = true; anim["MyClip"].weight = 1; anim.Sample(); anim["MyClip"].enabled = false; } }