我知道Unity有个Invoke方法可以延时,我也知道协程可以做延时,今天只是分享另外一种延时方式,供大家参考使用。
using System;
using System.Collections.Generic;
using UnityEngine;
public class DelayModel : MonoBehaviour
{
/// <summary>
/// 自己生成一个Obj来挂DelayModel 脚本
/// </summary>
GameObject go;
private static DelayModel _instance;
public static DelayModel Instance
{
get
{
if (_instance == null)
{
GameObject go = new GameObject("DelayManager");
go.AddComponent<DelayModel>();
_instance = go.GetComponent<DelayModel>();
}
return _instance;
}
}
private List<Delaytion> Delaylist =