Unity/C# note
유니티 Singleton 싱글톤 노트
오발탄LAB
2020. 12. 15. 22:26
반응형
private static GameManager instance = null;
private void Awake()
{
if (null == instance) {
instance = this;
DontDestroyOnLoad(this.gameObject);
}
else
{
Destroy(this.gameObject);
}
}
public static GameManager Instance
{
get
{
if (null == instance)
{
return null;
}
return instance;
}
}
반응형