Unity延迟调用

来源:互联网 发布:如何安装vb 编辑:程序博客网 时间:2024/05/16 17:16
<span style="font-size:14px;">using UnityEngine;using System.Collections;//Unity延迟调用public class Test : MonoBehaviour {    void Start()    {        // IEnumerator 方法必须使用如下方法进行调用        StartCoroutine("DelayDebug", 3.0f);        StartCoroutine(DelayDebug( 3.0f));    }    IEnumerator DelayDebug( float time)    {        //调用该方法,立即执行return前的代码        Debug.Log("first");        //延迟 time 秒执行return 后边的语句        yield return new WaitForSeconds( time);        Debug.Log("Debug");    }}</span>

0 0
原创粉丝点击