This commit is contained in:
Crizomb 2025-01-29 00:59:22 +01:00
parent a17810ffeb
commit 4e91f448c9
826 changed files with 66 additions and 8 deletions

View file

@ -0,0 +1,18 @@
using UnityEngine;
public class MonoBehaviourSingletonPersistent<T> : MonoBehaviour
where T : Component
{
public static T Instance { get; private set; }
public virtual void Awake ()
{
if (Instance == null) {
Instance = this as T;
Instance.name = typeof(T).Name;
DontDestroyOnLoad (gameObject);
} else {
Destroy (gameObject);
}
}
}