Search Unity

WaitForSecondsRealTime doens work as expected

Discussion in 'Scripting' started by Arcan-Studios, Jul 15, 2018.

  1. Arcan-Studios

    Arcan-Studios

    Joined:
    Mar 12, 2015
    Posts:
    58
    hi, i tried to use WaitForSecondsRealTime in an Time.timeScale = 0
    scenario, but didnt work, the api says its unscaled time
    but coroutine get stoppend and never resume execution, its this a bug? or im doing something wrong?

    sorry my mistake, just work now

    im coding bad

    work well
     
  2. mjzx

    mjzx

    Joined:
    Aug 18, 2013
    Posts:
    114
    Try this, it works fine for me:
    Code (CSharp):
    1. // Use this for initialisation
    2.     void Start () {
    3.         Time.timeScale = 0.0f;
    4.         StartCoroutine(Test());
    5.     }
    6.  
    7.     private IEnumerator Test () {
    8.         Debug.Log("Start");
    9.         yield return new WaitForSecondsRealtime(1.0f);
    10.         Debug.Log("Complete");
    11.     }
    You probably have an infinite loop in your coroutine. Could you share a snippet of your coroutine?
     
    Last edited: Jul 19, 2018
  3. Arcan-Studios

    Arcan-Studios

    Joined:
    Mar 12, 2015
    Posts:
    58
    thanks for answer, work well now i simply write bad the code, thanks