Issues with Animator not running animation when triggered.

So I have been working on my project for a few days now, it’s just a simple mobile game I felt like making.

The problem is I want a short animation for the pause menu when it opens and when it closes to make the game look better, the only issue is I cannot get it to work properly.

I have wrote the method PlayPauseAnim() for when the user presses the pause button, which at first works fine, it plays the animation and in the Animator window it waits for the trigger to send it to the closing animation and Debugs ‘Play’ as true and ‘Close’ as false. Here is where the problem occurs… When I then set the trigger for ‘Close’ to start the animation it doesn’t actually run the animation, instead, it skips it completely, despite ‘Play’ being false and ‘Close’ as true. I then press the pause button again, and the open animation doesn’t even play this time, even though in my Debug it says that ‘Play’ is true again and ‘Close’ is false (as it should be).

I have tried for hours to find a fix, changing the methods code, orders, renaming the two bools, rearranging the animator flow chart, checking the animations themselves and making sure the Animator’s UpdateTime is on Unscaled. :frowning:


The Two Methods: PlayPauseAnim() and ClosePauseAnim()


The Animator View

From Empty to PauseMenuOpenClip (Nothing → Opening Pause Menu)

Condition: Pause needs to be True.

From PauseMenuOpenClip to ClosePauseMenu(Opening Pause Menu-> Closing Pause Menu)

Condition: Close needs to be True.

Whichever script does the click handling and placing/destroying of blocks. If it isn't the player script, then "m_mainCamera.WorldToScreenPoint(transform.position))" becomes m_mainCamera.WorldToScreenPoint(YourPlayerScriptReference.transform.position))

1 Answer

1

Did you try a different code? SetBool instead of GetBool?

PauseAnim.SetBool ("Close", true);
PauseAnim.SetBool ("Paused", true);

Personally I think this is a better code than the long one you used for ClosePauseAnim().