How to make the script wait/sleep in a simple way in unity

前端 未结 5 1871
情话喂你
情话喂你 2020-11-22 12:03

How can I put a sleep function between the TextUI.text = ...., to wait 3 seconds between each phrase?

public Text GuessUI;
public Text TextUI;
         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 12:36

    here is more simple way without StartCoroutine:

    float t = 0f;
    float waittime = 1f;
    

    and inside Update/FixedUpdate:

    if (t < 0){
        t += Time.deltaTIme / waittime;
        yield return t;
    }
    

提交回复
热议问题