public void Hide() { if (text == null) { return; } subscription.Unsubscribe(); application.UI.Root.RemoveChild(text, 0); text = null; subscription = null; }
public override void OnSceneSet(Scene scene) { if (scene != null) { if (ReceiveFixedUpdates) { var physicsWorld = scene.GetComponent <PhysicsWorld>(); if (physicsWorld == null) { throw new InvalidOperationException("Scene must have PhysicsWorld component in order to receive FixedUpdates"); } physicsPreStepSubscription = physicsWorld.SubscribeToPhysicsPreStep(OnFixedUpdate); } if (ReceiveFixedPostUpdates) { var physicsWorld = scene.GetComponent <PhysicsWorld>(); if (physicsWorld == null) { throw new InvalidOperationException("Scene must have PhysicsWorld component in order to receive FixedUpdates"); } physicsPostStepSubscription = physicsWorld.SubscribeToPhysicsPostStep(OnFixedPostUpdate); } if (ReceivePostUpdates) { scenePostUpdateSubscription = scene.SubscribeToScenePostUpdate(OnPostUpdate); } } else { physicsPreStepSubscription?.Unsubscribe(); physicsPostStepSubscription?.Unsubscribe(); scenePostUpdateSubscription?.Unsubscribe(); } }
void UnsubscribeFromAppEvents() { updateSubscription?.Unsubscribe(); }