- Home /
Animator SetFloat Not Being Recognized
I'm getting this wierd error that says:
Assets/AnimatePlayer.cs(15,34): error CS1061: Type Animator' does not contain a definition for
SetFloat' and no extension method SetFloat' of type
Animator' could be found (are you missing a using directive or an assembly reference?)
This is my code:
using UnityEngine;
using System.Collections;
public class Animate : MonoBehaviour {
// Use this for initialization
Animator animator;
public GameObject player;
void Start () {
animator = GetComponent<Animator> ();
}
// Update is called once per frame
void Update () {
if (Input.GetKey(KeyCode.LeftShift)) {
animator.SetFloat("Speed",1);
}
}
}
You haven't by any chance created a script named "Animator"? In that case, that script will hide the Animator script from the UnityEngine namespace.
I did have a script named animator, but I renamed it and still got the error
nm removed the script formerly named animator and it fixed everything. thx
Answer by araz01 · Feb 21, 2020 at 01:45 PM
Unity Is Starting To Just Annoy Me... Why Can't Anything Be Convenient And Easy... Unreal Must Be The Future.. Unity Using These Old Ass Languages That DON'T Even WORK! Make Something Original And Simple... Just Simple... Why Do I Need To Use Another Language Just To Talk, I Should Have The Right To Change And Do Whatever I Want WITHOUT Being Questioned By A Terrible Software...