Pausing all scripts except for one

I want to make a typical “tap to screen” thing in my game. That means that my game is paused when it starts, and it resumes as soon as I tap on the screen.

Normally I would do this with a

Time.timeScale=0;

statement. The thing is that I’ve prepared a mini-animation that I want to run while I’m in this “pause mode” and this is frozen too.

What can I do? Can I exclude specific gameobjects or scripts from pausing with Time.timeScale=0 or something like that?

Either not use Time.deltaTime, or actually disbable the class’s you don’t want to use:

GameObject.Find(“GAMEOBJECT_NAME”).GetComponent().enabled = false;

you will then have to do it with every class, which might become messy…

last possiblity might be to make something like:

bool IsOn {
	get {
		return GameObject.Find("TimeController").GetComponent<TimeControlClass>().IsOn;
	}

}

/*And then in Update when you want things disabled when it's not on*/

void Update () {
	if(IsOn)
		DoThis();
}

Each possiblity have problems and are annoying in each their way. if you got questions, just ask :wink:

Here

You can have your script not rely on Time.deltaTime. Use Time.unscaledDeltaTime instead.

If physics is involved its another issue altogether and will probably end with some relatively messy work, or a custom physics engine.

try to make a mainGameLoop script with one update and one start , then call all the updates of the other scripts in this update… now if the game is paused choose the updates the you want to avoid …