- Home /
Animator is not playing an AnimatorController
In this script I made this part of the script is not playing an animation.
private void Update () {
if (Input.GetKeyDown(KeyCode.Q))
{
if (CctvMenu.gameObject.activeInHierarchy == false)
{
Pause();
Animator menuopener = Backgrounded.GetComponent<Animator>();
menuopener.SetBool("on", true);
}
}
}
public void Pause()
{
if (canvas.gameObject.activeInHierarchy == false)
{
canvas.gameObject.SetActive(true);
Time.timeScale = 0;
Player.GetComponent<FirstPersonController>().enabled = false;
Cursor.lockState = CursorLockMode.None;
}
else
{
canvas.gameObject.SetActive(false);
Time.timeScale = 1;
Player.GetComponent<FirstPersonController>().enabled = true;
Cursor.lockState = CursorLockMode.Locked;
}
}
The lines that or broken are these ones.
Animator menuopener = Backgrounded.GetComponent<Animator>();
menuopener.SetBool("on", true);
I have both of these exact lines in another script and they work perfectly fine., but in this script they are dun broke. Any help would be appreciated.
does Backgrounded have an Animator (not Animation) component during Runtime and an animator assigned?
Answer by ZachVille · Dec 24, 2018 at 07:52 PM
What does your Animator on the object look like? Are you sure you have put the AnimatorController the the slot for it on the Animator? @kyomazunki
Are you sure that the bool in the Controller is called on, not On? Can you also post a screenshot of what $$anonymous$$enuAnimator looks like?
Your answer
Follow this Question
Related Questions
root motion on in place animation 0 Answers
Check Animator State Animation Completed 0 Answers
Button animator not playing. 0 Answers
how to fix roll animation resets to animation start position 0 Answers