public override void OnRemovedFromScene() { base.OnRemovedFromScene(); if (!MyMultiplayerModApi.Static.IsServer) { return; } foreach (var evt in Definition.Events) { _eventBus.RemoveListener(evt, EventOccured); } _eventBus = null; _state = null; RemoveScheduledUpdate(Update); }
public override void OnRemovedFromScene() { if (_eventBus != null) { foreach (var evtAndOps in Definition.EventToOps) { _eventBus.RemoveListener(evtAndOps.Key, HandleEvent); } } if (_state != null) { _state.StateChanged -= OnStateChanged; } base.OnRemovedFromScene(); }