添加场景、对应场景代码
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameFramework
|
||||
{
|
||||
/// <summary>
|
||||
/// 场景级单例基类。每个场景里只存在一个实例,切场景后不保留。
|
||||
/// </summary>
|
||||
public class Singleton<T> : MonoBehaviour where T : Component
|
||||
{
|
||||
public static T Instance { get; private set; }
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
Instance = this as T;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user