https://answers.unity.com/questions/1225328/imported-animated-object-and-slider-tutorial.html
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour {
//Animation 需要将动画调为Legacy,
//自建的动画可以在Inspector面板下调为Debug模式,勾选上Legacy就可以了
//public Animation _animation;
public Animator _animator;
void Start () {
//_animation.Play("New Animation1");
// _animation["New Animation1"].speed = 0;
_animator.speed = 0;
}
float step = 0;
float timer = 0;
void Update () {
//if (Input.GetMouseButton(0))
//{
// timer += Time.deltaTime;
// if (timer>0.1f)
// {
// step += 0.1f;
// if (step <= 1)
// {
// _animation["New Animation1"].normalizedTime = step;
// Debug.Log(step);
// }
// else
// {
// step = 0;
// }
// timer = 0;
// }
//}
if (Input.GetMouseButton(1))
{
timer += Time.deltaTime;
if (timer > 0.1f)
{
step += 0.1f;
if (step <= 1)
{
_animator.Play("New Animation1", 0, step);
Debug.Log(step);
}
else
{
step = 0;
}
timer = 0;
}
}
}
}
So anything that is along the lines of using the slider to control the imported animation would be great. Please help! Thank you!
Import your fbx into your Unity project (Im using the 2D option)