private void Awake() { if (instance != null && instance != this) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } }
// Use this for initialization void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } enemies = new List <Enemy>(); DontDestroyOnLoad(gameObject); boardScript = GetComponent <BoardManager>(); InitGame(); }
void Start() { _Single = this; foreach (Transform t in allObj) { var c = t.GetComponent <Character>(); if (c != null) { all.Add(c); } } AllCount = all.Count(e => e.needToCount); UpdateCountUI(); playerCamera.gameObject.SetActive(true); }