Pause game

Hi. When i use of timescale for pause my game,the int variable dosn’t stop for proccess. I use of a int variable in a for loop to increese it. Because i need a timer for battery.

Even when you set ‘Time.timeScale’ to 0, you still get Update() calls. You really should be using a float for your flashlight and subtracting Time.deltaTime from your float values. By using an int, your flashlight will drain at different speeds depending on the frames per second.

If you just want to get what you have working again, you can check Time.timeScale before updating your int. Say your int was called batteryTimer:

if (Time.timeScale > 0.01)
  batteryTimer++;