void Awake() { if (instance == null) { instance = this; } objpool = new List <GameObject> (); for (int i = 0; i < poolcount; i++) { GameObject obj = Instantiate(prefab); obj.SetActive(false); objpool.Add(obj); } }
void Awake() { if (instance_ != null && instance_ != this) { Destroy(this.gameObject); return; } else { instance_ = this; } DontDestroyOnLoad(this.gameObject); InitializePool(); }