/// <summary> /// Called when the event was destroyed. /// </summary> public void OnDestroy() { ControlUnlock(); GameEvents.onEditorShipModified.Remove(EditorUpdate); GameEvents.onStageActivate.Remove(StageActivate); GameEvents.onVesselChange.Remove(VesselChange); GameEvents.onPartDestroyed.Remove(PartDestroyed); GameEvents.onVesselWasModified.Remove(VesselChange); if (_instance == this) { _instance = null; } }
/// <summary> /// Start this instance. /// </summary> public void Start() { if (_instance) { Destroy(_instance); } _instance = this; _winID = GUIUtility.GetControlID(FocusType.Passive); GameEvents.onEditorShipModified.Add(EditorUpdate); GameEvents.onStageActivate.Add(StageActivate); GameEvents.onVesselChange.Add(VesselChange); GameEvents.onPartDestroyed.Add(PartDestroyed); GameEvents.onVesselWasModified.Add(VesselChange); }