Пример #1
0
        public void Hide()
        {
            if (text == null)
            {
                return;
            }

            subscription.Unsubscribe();
            application.UI.Root.RemoveChild(text, 0);

            text         = null;
            subscription = null;
        }
Пример #2
0
        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();
            }
        }
Пример #3
0
 void UnsubscribeFromAppEvents()
 {
     updateSubscription?.Unsubscribe();
 }