Pause is not pausing right

I have a script of my own that pauses everything in the games, but the only thing isn’t working is that the player can instantiate the bullets but not shoot them, and also the players camera can look around. If anyone needs my script tell me.

  • Felipe

Well how do you pause your game?
You do it by setting the overall Time to 0? That just works if you use Time.deltaTime with everything you wanna pause( doesnt include instantiate i think then).
How about you post the parts which pause your game here?

You could make a “isPaused” variable that you would instanciate. If the game is paused, you prevent the bullet from being fired and you prevent the inputs from working.

Me, to pause, I do:

Time.timeScale = 0f;

And then I call a method that prevent the mouselook from working.

private void SetMouseLookEnabled(bool newvalue)
{
	Component[] mouseLooks = GameObject.FindGameObjectWithTag("Player").GetComponentsInChildren(typeof(SmoothMouseLook), false);
	foreach(Component mouseLook in mouseLooks)
	{
		((SmoothMouseLook)mouseLook).enabled = newvalue;
	}
}

Make sure you get the good script from your code and Enable/Disable them. You could enable and disable the shooting mechanics the same way too. It might not be a good way since I’m kind of new to Unity too. But it might work. :slight_smile: