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.
1
using
UnityEngine;
2
8
public
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
}
SingletonMonobehaviour
Abstract class that inherited by all the game managers. All the game managers use singleton since gam...
Definition:
SingletonMonobehaviour.cs:9
SingletonMonobehaviour.g_Instance
static T g_Instance
Definition:
SingletonMonobehaviour.cs:10
SingletonMonobehaviour.Awake
virtual void Awake()
Definition:
SingletonMonobehaviour.cs:20
SingletonMonobehaviour.Instance
static T Instance
Definition:
SingletonMonobehaviour.cs:13
Assets
Scripts
Misc
SingletonMonobehaviour.cs
Generated on Thu Jun 1 2023 20:52:47 for A 2D Farming RPG by
1.9.5