Unity 2D : C# : Animation : CS1061 : Animation does not contain definition for SetFloat..
Hi guys; Been wrestling with this all evening, feel it MUST be something obvious. This is a snippet of code from my script, the error it gives me is above. It does the same with a Bool too. Last time I used animation was ~a year ago, but I remember it being quite simple. Have I missed something obvious?
public Animation Anim;
// Use this for initialization
void Start () {
Anim= GetComponent<Animation>();
}
// Update is called once per frame
void Update () {
Anim.SetFloat("Speed", MoveSpeed);
Thanks for looking guys.
Answer by Orami · Dec 12, 2016 at 10:51 PM
I think you want a handler to the Animator component and not the animation component.
It didn't like Animator at all though..It would only accept Animation..
The animator component is what uses the flow chart you must add that float in under the animator tab on your viewport...
$$anonymous$$ake sure you have both the animation AND animator attached to the same object as well. Without seeing the inspector I can only guess as to how you have things set up.
Ahhh Ok. Il throw up a picture of the Inspector tomrrow?