Animator is not playing an AnimatorController (218133)

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?

1 Answer

1

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

[129975-capture.png|129975] @ZachVille

Are you sure that the bool in the Controller is called on, not On? Can you also post a screenshot of what MenuAnimator looks like?