How to make TimeScale Smooth ? and how i can make the timeScale doesn't effect the player ?


i am working on 2D platformer game but i have problem when i scale the time the object looks very lagy ?

and i have another Question : How i can make the timescale effect all the objects expect the player ?

A very kind soul on the internet gave the answer on here

The gist of it is to add these two lines

  Time.timeScale = 0.5;
  Time.fixedDeltaTime = 0.02F * Time.timeScale;

The fixedDeltaTime is what causes the smoothness to play out. If for whatever reason you need to revert the game back to normal speeds. I apply this after all the actions are completed.

   Time.timeScale = 1;
   Time.fixedDeltaTime = 0.02F ;

Seems to work for me.

Happy coding and hope this helps others. If it does upvote me please :slight_smile:

Could you paste some code? Are you using Time.deltaTime?

You can’t, timescale effects the whole application, not certain objects. Try changing the speed independently for any object you wish to move slower or faster.