private void OnDestroy() { NavArea2DManager navManager = FindObjectOfType <NavArea2DManager>(); if (navManager != null) { navManager.navAreas.Remove(this); } }
private void Awake() { NavArea2DManager navManager = FindObjectOfType <NavArea2DManager>(); if (navManager != null) { if (navManager.navAreas.Contains(this) == false) { navManager.navAreas.Add(this); } } }