unity 控制模型动画播放,Animation学习。
此脚本挂载在带有动画的模型上。
csharp
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AnimationCtrl : MonoBehaviour
{
void Start()
{
PlayAnimation();//开始的时候调用播放动画的方法
}
void Update()
{
}
private void PlayAnimation()
{
Animation animation = GetComponent<Animation>();
// 精确播放
animation["Take 001"].time = 63.0f; // 跳转到第63秒
animation["Take 001"].speed = 1.0f; // 设置速度
animation.Play("Take 001");
}
}