Pausing a particular game object and unpausing.

Hi, is it possible to make particular sets of game objects to pause during the game? I’m trying to do pause and unpause particular objects. Any ideas? Thank you!

How are you moving your game objects? Rigidbody, character controller, or Translating? Are you going to have different buttons pause different things, or only a single pause for this group of game objects?

Most of them are rigid body. Only a single pause for this group of game objects. Is there unity defined function for that? or should we have to do manually? I don't want them to update at particular point.

There is no Unity function for this. You will have to do them individually. You will have to figure out how to communicate to these scripts that a pause is in progress...a static variable, a common script they referecne...and then have each individual object pause (or an outside script pause for them). For pausing a Rigidbody, you might try setting the isKinematic flag to true.

Oh okay. Thanks for the info!

2 Answers

2

A solution to a pause for a certain group of objects is to relate their movement to time, and then set the timescale to 0. So a movement times 0 will always be zero. Shrugs I’ve done something like this in the past and it works pretty well, just depends on what you’re doing I suppose.

Not just movement, I want entire functions to shut down. For example, I want to stop updating enemies, it should stop spawning them, shooting bullets etc.

no, we cannot pause the particular object in the scene rather we can stop that functionality if you use the time scale is 0 the total scene will be pause.