How to Pause Menu with Animating Button Works?

Hello there,

I need some assistance in creating pause menu, as after browse the web I found the “timescale” method and then since implement it sadly my animation buttons also stopped. I have also browse the entire unity forums and have found couple of solutive answer in using standard boolean stuffs, or the realtime thing. But really I still couldn’t get what it does really meant :frowning:

So here’s my code looks like.

Declare variable

public GameObject blackPanel;
public Animator restartPanel;
public Animator optionsPanel;

And then, I put function.

public void restartConfirm(){
		optionsPanel.SetBool("isHidden", false);
		restartPanel.SetBool("isHidden", true);
		blackPanel.SetActive (true);
		Time.timeScale=0;
	}

And after assigning the related gameobject and animator, I went to set the OnClick() function to be assigned to restartConfirm() function.

So the case here, the optionsPanel and restartPanel have animation also, as if I put Time.timeScale it will freeze everything.

I have no update() function in the script.

And then how to make the animation work well, and then paused another else?

Thanks!

The Animator has an “Update Mode” called Unscaled Time.

From the docs:

UnscaledTime Animator updates independently of Time.timeScale.