How to use Time.timeScale properly

Hello, I have developed an application where I capture the pictures of a camera, so in specific cases I need the objects to slow down (almost paused) for a period of time and then they will return to normal speed and so on. He tried to use the function Time.timeScale = 0 and Time.timeScale = 1 but I don’t get it to be something periodic, the code I have is:

       bool StepSimulator = false; //indicator that status game  
       float currentTime = 0;  
       float maxTime = 2;     //Tiem to paused an normaly game velocity  
       currentTime += Time.deltaTime;  
       if (Time.timeScale == 1 && currentTime >= maxTime )
       {  
            currentTime = 0;
            StepSimulator = true;
            Time.timeScale = 0;     //velocity = 0 --> pause
        }
        else if (Time.timeScale == 0 && currentTime >= maxTime)
        {
            currentTime = 0;
            // si la velocidad es 0 es igual a una pausa
            StepSimulator = false;
            Time.timeScale = 1;     // velocity normal back a 1
        }

la idea es:

-paused game2 seconds

-normal game 2 seconds

-paused game 2 seconds

-normal game 2 seconds

. así sucesivamente

Hello / Buenas.

MODERATORS: If this post is not translated to english on Febr 6th, we can remove it

El time.scale lo que ahce es cambiar el “reloj interno” de Unity. Cuando estas intentando calcular el tiempo que transcurre usando Time.deltaTime pero el timescale es 0, nunca vas a detectar nada, ya que el time.deltatime siempre sera 0.

No se que pretendes, pero viendo que no dominas el tema tiempo en Unity, te recomiendo que no modifiques el TimeScale, porque todo lo dependiente del internal timer de unity te va cambiar (update, LAteUpdate, FixedUpdate, Corutines, Yields, Invokes…)

Suerte.