/// <summary> /// Remove listeners from floating origin update and unload events. /// </summary> void OnDisable() { FloatingOriginUpdater floatingUpdater = BaseMapLoader.gameObject.GetComponent <FloatingOriginUpdater>(); if (floatingUpdater != null) { floatingUpdater.OnFloatingOriginUpdate.RemoveListener(OnFloatingOriginUpdated); } DynamicMapsUpdater dynamicUpdater = BaseMapLoader.gameObject.GetComponent <DynamicMapsUpdater>(); if (dynamicUpdater != null) { dynamicUpdater.UnloadedEvent.RemoveListener(OnRegionUnloaded); } ClearAndReload(); }
/// <summary> /// Register listeners for floating origin update and unload events so we can move or remove /// labels as appropriate. /// </summary> void OnEnable() { FloatingOriginUpdater updater = BaseMapLoader.gameObject.GetComponent <FloatingOriginUpdater>(); if (updater != null) { updater.OnFloatingOriginUpdate.AddListener(OnFloatingOriginUpdated); } DynamicMapsUpdater dynamicUpdater = BaseMapLoader.gameObject.GetComponent <DynamicMapsUpdater>(); if (dynamicUpdater != null) { dynamicUpdater.UnloadedEvent.AddListener(OnRegionUnloaded); } ClearAndReload(); }