unity协同程序带参数并延迟执行

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DaiCanShu : MonoBehaviour
{
   void Start()
   {
        StartCoroutine(CanShu(2f));
    }

    IEnumerator CanShu(float arr)
    {
        yield return new WaitForSeconds(arr);
        Debug.Log("xxx");
    }
}

挂载在物体上变回实现延迟2秒输出xxx。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>