This commit is contained in:
2026-10-14 19:39:24 +08:00
parent 4fd5a3bd45
commit 8498afd5cf
202 changed files with 12624 additions and 236 deletions
@@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AutoMonoSingleton<T>: MonoBehaviour where T : MonoBehaviour
{
private static T _instance;
public static T Instance
{
get
{
if(_instance==null)
{
GameObject obj = new GameObject();
obj.name = typeof(T).ToString();
DontDestroyOnLoad(obj);
_instance = obj.AddComponent<T>();
}
return _instance;
}
}
}