使用案例
using QFramework;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UseCase : MonoBehaviour,ISingleton
{
public static UseCase Instance
{
//获取并返回实例
get { return MonoSingletonProperty<UseCase>.Instance; }
}
public void OnSingletonInit()
{
throw new System.NotImplementedException();
}
private void OnDisable()
{
//销毁单利
MonoSingletonProperty<UseCase>.Dispose();
}
/// <summary>
/// 输出
/// </summary>
public void Output()
{
Debug.Log("Hello world!!");
}
}
注
有生命周期单利模式必须挂在当前场景物体上才能正常使用