This seems like a common topic, but I couldn’t find any exact solutions to this problem in the forums.
I was hoping to be able to change the speed of a GameObject’s animation in the inspector.
I was thinking that creating a public float to hold a speed value which was multiplied by the Time.deltaTime time that the animation was playing at, might be a way to do it.
If anyone can see what I was trying to do in the following, and point me in a better direction, thanks for your time.
using UnityEngine;
using System.Collections;
public class AnimationSpeedChange : MonoBehaviour {
public GameObject Person;
public float MoveSpeed = 1.0f;
// Use this for initialization
void Start() {
}
// Update is called once per frame
void Update() {
Person.GetComponent<Animation>().Play("Walk" * MoveSpeed * Time.deltaTime);
}
}