void OnDestroy() { if (s_Instance == this) { s_Instance = null; } }
void Awake() { if (s_Instance != null && s_Instance != this) { Debug.LogError ("Second singleton instance. Bailing."); Destroy (gameObject); return; } for (int i = 0; i < m_Waypoints.Count;) { if (m_Waypoints[i] == null) { m_Waypoints.RemoveAt (i); } else { i++; } } s_Instance = this; }