Slow motion everything but player.

Hello.

I want to “slow motion time” on every object in the scene including physics and scripts, but also want my player character (rigidbody) continues normal movement.
I’ve used things like sending pause messages:
Player script:

	if (Input.GetMouseButton(1)){
		var objects : Object[] = FindObjectsOfType(GameObject);
			for (var pause : GameObject in objects) {
			pause.SendMessage ("ScriptPaused", SendMessageOptions.DontRequireReceiver);
		}
	}
}

Another object script:

private var paused : boolean;
 
function ScriptPaused(){
	paused = true;
} 
function Update (){
	if (!paused) {
		// script
	}
}

Also setting objects kinematic to true and pausing mecanim animations. It works fine in pause, but I want to know if it’s possible use Time.timeScale to slow motion specific objects or create my own deltaTimes and how’s Fixed and LateUpdate affected.

Thanks.

I would guess you have everyone moving using Time.deltaTime. I fyou modify Time.timeScale you can modify the speed of execution, with 0 < timeScale < 1 you slow down all movement and animations since they are based on deltaTime which gets affected.

But your player will also slow down so you need to get him back to one.

you can easily put this one at the top of your player script, so that your player moves normal speed:

if(slowDown){
    timeScale = 1;
}

and then at the end you set it back for other scripts

if(slowDown){
    timeScale = slowSpeed
}

this way no big computation required and this will work as long as you do not have multi threading (I doubt you have anyway).