On time slow down only player enable to move

hi, i am using to Time.timeScale for slowing down time by pressing “t”. I am getting everything slowed down including the player. Is there anyway to slow down everything except the player. here is my script, i have still some works to do, like adding a coroutine for
making the time slow down temporary.

var slowammount: float = 0.2;
var visible;
var skin:GUISkin;
var slowtex : Texture;


function Start()
{ 
 Time.timeScale = 1;
 visible = false;
}

function OnGUI()
{
if (skin != null) 
{
   GUI.skin = skin;
}
if(visible == true){
if(Time.timeScale == slowammount) {

GUI.DrawTexture(new Rect(0,0,Screen.width, Screen.height), slowtex);



 }
}
}
  
    
function Update () 
{
if (Time.timeScale == 1)
 {
  if (visible == false){

   if (Input.GetKeyDown("t")) 
    {

visible = true;
Time.timeScale = slowammount;
 
    }
   }
  }
  
}

Not everything slows down when you set timeScale, only the actions happening in the FixedUpdate or anything using deltaTime or other Time members.

You could get your player going normal speed while everything is slowed down around making its move time independant:

player.Move(direction*speed);

Then, timeScale won’t matter. On the other had, you are not machine independent anymore as you are moving per frame and some computers go faster than others.

You can then use a little trick using Time classes again (I know I said no more time thing but hold on)… You can use store the previous Time.time and subtract the new one.

float previous;

float delta = Time.time - previous;
previous = Time.time;
player.Move(direction*speed*delta);

well, you’d have to manually modify all that is related to the player by multiplying with the inverse of the timeScale, to get everything to normal speed again.

So if timeScale was 0.5f:
You’d have to change the player’s animation speed to

animation["Walk"].speed = 1 / Time.timeScale; // The animation will thus play at speed 2, but since the timescale reduces time by half, you get your normal speed again.

and change it back if your timeScale changes