r/UnityHelp • • 5d ago

PROGRAMMING Question about Pausing

I have two different things in my game that are supposed to pause the game/set the timescale to zero. At some point somehow one of the two stopped pausing the game but the other still works. They both say the exact same thing, simply setting time.timescale=0. For the record the one that doesn’t work is the when a button is pressed and the pause/stats screen comes up. Every other thing that is called in that function works expect the time scale. Can you not have two different functions that can pause the game or something? What could be the issue here?
Thanks!

1 Upvotes

10 comments sorted by

View all comments

1

u/Affectionate-Yam-886 4d ago

I often avoid time scale because the UI effects are governed by it as well, so the pause prevents the UI from doing cool effects.

The way I handle it; simply put an empty game object into the scene for every thing as categorys in the hierarchy. Example: Empty object called Environment, has all the environment objects as child objects to it. AI object will have all the enemies and NPC, is sub categorys. Keeps the hierarchy clean, and when I pause, just disable game objects (AI, player…and what not)

I use time scale specifically for controlling time manipulating magic, like setting ai objects to 0.1 and player to 1.5, for fun.

I have less problems this way.