Keeping Some Game Objects From Being Paused

Hi all,
I am using Time.timeScale = 0; to pause the game. But what if I want some objects which are using time.deltaTime not being paused? When an object is instantiated to interact with user, everything else must be paused except this one.

Are there any solutionsfor that?

Thank you for your time :slight_smile:

You can use MonoBehaviour to pause instead of Time.timeScale. I Like to create a script with a MonoBehaviour array and place all scripts i need to pause. Then all you have to do is use enable. (eg)

var scriptToggle : MonoBehaviour[];

function Update() {
     if( // I tell it to do so || The condition is met || My bool is true ) {
     for(var s in scriptToggle)
     s.enabled = false;
     {
     else {
     for(var s in scriptToggle)
     s.enabled = true;
   }
}

Ofc This is just an example to give you an idea. This method works good for all kinds of effects (eg)
If characters are trying to kill you you can just cut off there ai script instead of stopping everything then it looks cool cause they just hang out in front of you in idle.:slight_smile:

Thanks Black Mantis. It’s a very nice solution :slight_smile: