728x90 싱글톤1 Unity & C# ~ Singleton(싱글톤) //예제1 private static T _instance = null; public static T _Instance { get { if (_instance == null) { _instance = FindObjectOfType(typeof(T)) as T; } return _instance; } } //예제2 private static T _instance = null; public static T _Instance { get { if (_instance == null) { _instance = FindObjectOfType(typeof(T)) as T; if (_instance == null) { GameObject obj = new GameObject(); obj.name = "NAME"; _in.. 2022. 5. 20. 이전 1 다음 SMALL