I'm doing an android 2d platformer. In the Animator everything is set up. On applicaton start does everything right but when I click on the button the bool parameter does not change so my animation won't play backwards. But when I tick the bool parameter in the animator the animation plays right as it should. No console errors. Here is my script.
I was using this tutorial and from it I just needed the first part (the "Start game" animation part). I followed every step. Probably I'm missing something.
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine.UI;
using UnityEngine;
public class UIManager : MonoBehaviour
{
public Animator optionsButton;
public void OpenSettings()
{
optionsButton.SetBool("isHidden", false);
}
}
My goal is to play the animation backward when the option button is pressed and I want to change the bool parameter through a script.
OpenSettins()
method being called? add a debug message to it to make sure it is being called when you click the button. I say this as you might not have asigned the buttons onClick method in the editor. - akaBaseanimator == null
to check if it is null or not. I am starting to think that you have the single clip in you Animator and it is running the animation when you start the game/scene and then finishes. If so you need to restart it usingoptions.Play("nameofnanimation")
, also look intoCrossFade
- akaBase