Search Unity

No momentum after setting timescale back to normal

Discussion in 'Scripting' started by TukTuk_420, Jan 18, 2021.

  1. TukTuk_420

    TukTuk_420

    Joined:
    Jan 15, 2021
    Posts:
    2
    So im making a 2d game, and implemented a pause function that sets the time.timescale to 0f. Now the problem is that after resuming the game which sets the time.timescale to 1f my player does not continue the movement. For example if i pause mid air while my character was going left it will just fall to the ground in one place instead of continuing the movement. Is it possible to fix this issue?
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,735
    Looks like whatever you are using to update lateral momentum is continuing to update even when timeScale is zero. Look there first. Perhaps all you need is something in your Update() (or FixedUpdate()) that stops processing when timeScale is zero?
     
    Joe-Censored likes this.