A 2D Farming RPG
This is just a simple 2D farming RPG game
Loading...
Searching...
No Matches
SingletonMonobehaviour.cs
Go to the documentation of this file.
1using UnityEngine;
2
8public abstract class SingletonMonobehaviour<T> : MonoBehaviour where T:MonoBehaviour
9{
10 private static T g_Instance;
11
12 public static T Instance
13 {
14 get
15 {
16 return g_Instance;
17 }
18 }
19
20 protected virtual void Awake()
21 {
22 if( g_Instance == null )
23 {
24 g_Instance = this as T;
25 }
26 else
27 {
28 Destroy(gameObject);
29 }
30 }
31}
Abstract class that inherited by all the game managers. All the game managers use singleton since gam...