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?
– hexagonius