Timer manipulation with timescale not working correctly

I am currently creating a game where you have a character moving like in the game “Lemmings” and there is a button to adjust the speed of the game.
I adjust this speed by changing the timescale and the character indeed moves,jumps, falls etc faster and the Timer included in the game also counts up faster.
But there is a problem in where I beat a certain level on 1.0f timescale in 23 seconds, but when I speed up the entire level to 2.0f its 18 seconds.

Shouldn’t these both be 23 seconds as well? Since everything moves faster on the timescale?

I checked this with a real life stopwatch and the 23 seconds were correct, but the second level time(sped up) I would except it would be about 11.5 seconds(half of the 23 since it would be 2.0f), but its 9.5 seconds.

Now my question is how can I make it so even if I speed up time or slow down time the end time will always be the same(when going slow or fast with the speed)?

Adjusting the speed of just the character is out of the question since some obstacles etc don’t work anymore then based on their movespeed/jumplength etc

Here is the code how my time shows up:

 void Update()
    minutes = (int)(Time.timeSinceLevelLoad / 60f);
    seconds = (int)(Time.timeSinceLevelLoad % 60f);
    timerText.text = minutes.ToString("00") + ":" + seconds.ToString("00");

Here is the code my SpeedUp button uses

  public void GameSpeed()
    if (currentTimeSpeed == timeSpeedSlow)
      Time.timeScale = timeSpeedFast;
      currentTimeSpeed = timeSpeedFast;
      Time.timeScale = timeSpeedSlow;
      currentTimeSpeed = timeSpeedSlow;


Where timeSpeedSlow is 1.0f and timeSpeedFast is 2.0f;

Hi, messing with the Timescale isn’t typically the best of ideas. It would better for you to create a variable, such as a float called speed; and then multiply all of your movement calculations with this variable when you want your game to speed up and slow down.

So for example, when you want a rigidbody to move, you would do:

public float speed;

private void Update()
    GetComponent<Rigidbody>().AddForce(Vector3.forward * speed);

And then, by editing your speed variable, you can change your objects to move faster or slower. If everything that moves shares the same variable, then they would all move at the same speed.

Hope this helps, -Greg

@OtunGroup is right. Although, using Time.timeScale makes it easy to do things like Slow Motion, it will only apply to :

  1. Physics controlled objects
  2. Objects you control with Framerate independent transforms, using Time.deltaTime as a multiplier.

Ie :

[SerializeField] float _speed = 1f;

void Update ()
    transform.Translate (Input.GetAxis("Horizontal") * _speed * Time.deltaTime, 0, 0);