- Home /
Parameters in Animator not showing up when set in c#
I have this
public Animator anim;
private float inputH;
private float inputV;
// Use this for initialization
void Start()
{
anim = GetComponent<Animator>();
}
// Update is called once per frame
void Update()
{
inputH = Input.GetAxis("Horizontal");
inputV = Input.GetAxis("Vertical");
anim.SetFloat("inputH", inputH);
anim.SetFloat("inputV", inputV);
}
}
NO matter what i do it will not show up in the parameters in animator
Unsure what is my problem.
Answer by Zoogyburger · Aug 15, 2016 at 08:34 PM
That's because you need to create the parameters in the animator. So to the right where it says Name, click on the plus button. Create two floats called inputH and inputV so that you can control the two floats by script. If that isn't clear enough, let me know!
Answer by lunoland · Aug 15, 2016 at 08:41 PM
The member variables of some class that you write are not explicitly related to the parameters that belong to an Animation Controller.
You create parameters in the Animation Controller by clicking that "+" button in the upper right. Then you can access those values in your script using the Get/Set methods in Animator that correspond to the parameter's type.
Your code is otherwise OK, you just need to go ahead and click that button, and create two float type parameters named "inputH" and "inputV" in the animation controller.
In other words, the parameters are created/managed in the inspector and belong to the Animation Controller. Your script accesses them to get or set their values using the methods in Animator.
Your answer
![](https://koobas.hobune.stream/wayback/20220612090835im_/https://answers.unity.com/themes/thub/images/avi.jpg)