Hi, I’m using Mecanim Animation System in Unity 4.5.x.
I have an Animator component on a GameObject called “VictorSprite”, with several layers, each layer has several AnimationStates.
How can I access each AnimationState to change its properties, specifically speed?
Unfortunately, most of the documents I can find are deprecated, and don’t refer to Mecanim. I have also tried this code:
AnimationState animState = GameObject.Find("VictorSprite").GetComponent<Animator>().animation["VictorTalk"];
But, I receive this error message: “MissingComponentException: There is no ‘Animation’ attached to the “VictorSprite” game object, but a script is trying to access it.
You probably need to add a Animation to the game object “VictorSprite”. Or your script needs to check if the component is attached before using it.”
Adding Animation component is not recommended anymore in Unity 4.x.
Could anyone help please?