Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- public abstract class SingletonBehaviour<T> : MonoBehaviour
- where T : SingletonBehaviour<T>{
- public static T Instance { get; private set; }
- void Awake(){
- if(Instance == null){
- Instance = this as T;
- onAwake();
- }
- else Destroy(this);
- }
- protected virtual void onAwake(){ }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement