Exemple #1
0
        private void Init(OnSetupVRReady _)
        {
            OnSetupVRReady.UnregisterSetupVRCallback(Init);

            VRInteractionAuthoring vrInteractionAuthoring = GetComponent <VRInteractionAuthoring>();

            // If the device loaded is included in the device using this CBRA
            if ((vrInteractionAuthoring.DeviceUsingFeature & VRDF_Components.DeviceLoaded) == VRDF_Components.DeviceLoaded)
            {
                var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

                var archetype = entityManager.CreateArchetype(typeof(BaseInputCapture), typeof(TouchpadInputCapture), typeof(ControllersInteractionType));

                var entity = entityManager.CreateEntity(archetype);

                InteractionSetupHelper.SetupInteractions(ref entityManager, ref entity, vrInteractionAuthoring);

                entityManager.AddComponentData(entity, new NonLinearUserRotation {
                    DegreesToRotate = this._degreesToRotate
                });

                if (_destroyEntityOnSceneUnloaded)
                {
                    Core.OnSceneUnloadedEntityDestroyer.CheckDestroyOnSceneUnload(ref entityManager, ref entity, gameObject.scene.buildIndex, "NonLinearRotationAuthoring");
                }

#if UNITY_EDITOR
                // Set it's name in Editor Mode for the Entity Debugger Window
                entityManager.SetName(entity, "User Non Linear Rotation Entity");
#endif
            }

            Destroy(gameObject);
        }
        private void Init(OnSetupVRReady _)
        {
            OnSetupVRReady.UnregisterSetupVRCallback(Init);

            VRInteractionAuthoring vrInteractionAuthoring = GetComponent <VRInteractionAuthoring>();

            // If the device loaded is included in the device using this CBRA
            if ((vrInteractionAuthoring.DeviceUsingFeature & VRDF_Components.DeviceLoaded) == VRDF_Components.DeviceLoaded)
            {
                var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

                var entity = entityManager.CreateEntity
                             (
                    typeof(BaseInputCapture),
                    typeof(TouchpadInputCapture),
                    typeof(ControllersInteractionType),
                    typeof(LinearUserRotation)
                             );


                // Add the corresponding input, Hand and Interaction type component for the selected button.
                // If the button wasn't chose correctly or any parameter was wrongly set, we destroy this entity and return.
                if (!InteractionSetupHelper.SetupInteractions(ref entityManager, ref entity, vrInteractionAuthoring))
                {
                    entityManager.DestroyEntity(entity);
                    return;
                }

                entityManager.AddComponentData(entity, new LinearUserRotation
                {
                    CurrentRotationSpeed = 0.0f,
                    MaxRotationSpeed     = _maxRotationSpeed,
                    AccelerationFactor   = _accelerationFactor
                });

                if (UseDecelerationEffect)
                {
                    entityManager.AddComponentData(entity, new LinearRotationDeceleration
                    {
                        DecelerationFactor = DecelerationFactor
                    });
                }

                if (_destroyEntityOnSceneUnloaded)
                {
                    Core.OnSceneUnloadedEntityDestroyer.CheckDestroyOnSceneUnload(ref entityManager, ref entity, gameObject.scene.buildIndex, "LinearRotationAuthoring");
                }

#if UNITY_EDITOR
                // Set it's name in Editor Mode for the Entity Debugger Window
                entityManager.SetName(entity, "User Linear Rotation Entity");
#endif
            }

            Destroy(gameObject);
        }
Exemple #3
0
        public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
        {
            var interactionSet = GetComponent <VRInteractionAuthoring>();

            InteractionSetupHelper.AddInputCaptureComponent(ref dstManager, ref entity, interactionSet);
            InteractionSetupHelper.AddButtonHand(ref dstManager, ref entity, interactionSet.ButtonHand);

            // We add a new pointer click to store
            dstManager.AddComponentData(entity, new PointerClick
            {
                ControllersButton = interactionSet.ButtonToUse,
                HandClicking      = interactionSet.ButtonHand,
                CanClick          = true
            });

            dstManager.AddComponentData(entity, new DestroyOnSceneUnloaded());

            Destroy(interactionSet);
            Destroy(this);
        }
        public void AddPointerClickComponents(ref Entity entity, ref EntityManager entityManager)
        {
            var interactionParameters = GetComponent <VRInteractionAuthoring>();

            // If the device loaded is included in the device list using this PointerClickAuthoring
            if ((interactionParameters.DeviceUsingFeature & VRDF_Components.DeviceLoaded) == VRDF_Components.DeviceLoaded)
            {
                // We add a new pointer click to store
                entityManager.AddComponentData(entity, new VRClicker
                {
                    ControllersButton = interactionParameters.ButtonToUse,
                    HandClicking      = interactionParameters.ButtonHand,
                    CanClick          = true
                });

                // Add the corresponding input, Hand and Interaction type component for the selected button.
                // If the button wasn't chose correctly or any parameter was wrongly set, we destroy this entity and return.
                if (!InteractionSetupHelper.SetupInteractions(ref entityManager, ref entity, interactionParameters))
                {
                    entityManager.DestroyEntity(entity);
                    return;
                }

                // If we use the simulator, we check for a SimulatorButtonProxy. if not null, we add the simulatorButtonProxy script
                if (VRDF_Components.DeviceLoaded == SetupVR.EDevice.SIMULATOR)
                {
                    GetComponent <Simulator.SimulatorButtonProxyAuthoring>()?.AddSimulatorButtonProxy(ref entityManager, ref entity, interactionParameters);
                }

#if UNITY_EDITOR
                // Set it's name in Editor Mode for the Entity Debugger Window
                entityManager.SetName(entity, string.Format("VR Clicker Entity from GO {0}", transform.name));
#endif

                Destroy(this);
            }
        }
Exemple #5
0
        private void Init(OnSetupVRReady _)
        {
            OnSetupVRReady.UnregisterSetupVRCallback(Init);

            VRInteractionAuthoring interactionParameters = GetComponent <VRInteractionAuthoring>();

            // If the device loaded is included in the device using this CBRA
            if ((interactionParameters.DeviceUsingFeature & VRDF_Components.DeviceLoaded) == VRDF_Components.DeviceLoaded)
            {
                var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

                var archetype = entityManager.CreateArchetype
                                (
                    typeof(BaseInputCapture),
                    typeof(ControllersInteractionType),
                    typeof(VRRaycastOutputs),
                    typeof(VRRaycastOrigin),
                    typeof(VRRaycastParameters),
                    typeof(StepByStepComponent),
                    typeof(GeneralTeleportParameters),
                    typeof(TeleportNavMesh)
                                );

                var entity = entityManager.CreateEntity(archetype);

                // Setting up Interactions
                if (!InteractionSetupHelper.SetupInteractions(ref entityManager, ref entity, interactionParameters))
                {
                    entityManager.DestroyEntity(entity);
                    Destroy(gameObject);
                    return;
                }

                // Setting up Raycasting
                if (!TeleporterSetupHelper.SetupRaycast(ref entityManager, ref entity, interactionParameters, 10))
                {
                    entityManager.DestroyEntity(entity);
                    Destroy(gameObject);
                    return;
                }

                // Setting up General Teleporter Stuffs
                TeleporterSetupHelper.SetupTeleportStuffs(ref entityManager, ref entity, GetComponent <GeneralTeleportAuthoring>());

                // Setup Specific sbs teleporter
                entityManager.SetComponentData(entity, new StepByStepComponent
                {
                    DistanceStepByStep   = _distanceStepByStep,
                    StepHeight           = _stepHeight,
                    DebugCalculationsRay = _debugCalculationRays
                });

                if (_destroyEntityOnSceneUnloaded)
                {
                    OnSceneUnloadedEntityDestroyer.CheckDestroyOnSceneUnload(ref entityManager, ref entity, gameObject.scene.buildIndex, "StepByStepAuthoring");
                }

#if UNITY_EDITOR
                // Set it's name in Editor Mode for the Entity Debugger Window
                entityManager.SetName(entity, "StepByStep Teleport Entity");
#endif
            }

            Destroy(gameObject);
        }
        private void CreateEntity(OnSetupVRReady info)
        {
            var interactionParameters = GetComponent <VRInteractionAuthoring>();

            // If the device loaded is included in the device using this CBRA
            if ((interactionParameters.DeviceUsingFeature & VRSF_Components.DeviceLoaded) == VRSF_Components.DeviceLoaded)
            {
                var entityManager = World.Active.EntityManager;

                var archetype = entityManager.CreateArchetype
                                (
                    typeof(BaseInputCapture),
                    typeof(ControllersInteractionType),
                    typeof(CBRATag)
                                );

                var entity = entityManager.CreateEntity(archetype);
                entityManager.AddComponentData(entity, new CBRATag());

                // Add the corresponding input, Hand and Interaction type component for the selected button. If the button wasn't chose correctly, we destroy this entity and return.
                if (!InteractionSetupHelper.SetupInteractions(ref entityManager, ref entity, interactionParameters))
                {
                    entityManager.DestroyEntity(entity);
                    return;
                }

                bool cbraHasEvents = false;

                // If at least one of the unity event for the click has a persistent listener set in the editor
                // Add the CBRA Click Events component to the ClickEvents dictionary
                if (OnButtonStartClicking.GetPersistentEventCount() > 0 || OnButtonStartClicking.GetNonPersistentListenersCount() > 0)
                {
                    cbraHasEvents = true;
                    CBRADelegatesHolder.StartClickingEvents.Add(entity, new Action(delegate { OnButtonStartClicking.Invoke(); }));
                }
                if (OnButtonIsClicking.GetPersistentEventCount() > 0 || OnButtonIsClicking.GetNonPersistentListenersCount() > 0)
                {
                    cbraHasEvents = true;
                    CBRADelegatesHolder.IsClickingEvents.Add(entity, new Action(delegate { OnButtonIsClicking.Invoke(); }));
                }
                if (OnButtonStopClicking.GetPersistentEventCount() > 0 || OnButtonStopClicking.GetNonPersistentListenersCount() > 0)
                {
                    cbraHasEvents = true;
                    CBRADelegatesHolder.StopClickingEvents.Add(entity, new Action(delegate { OnButtonStopClicking.Invoke(); }));
                }

                // If at least one of the unity event for the touch has a persistent listener set in the editor
                // Add the CBRA Click Events component to the ClickEvents dictionary
                if (OnButtonStartTouching.GetPersistentEventCount() > 0 || OnButtonStartTouching.GetNonPersistentListenersCount() > 0)
                {
                    cbraHasEvents = true;
                    CBRADelegatesHolder.StartTouchingEvents.Add(entity, new Action(delegate { OnButtonStartTouching.Invoke(); }));
                }
                if (OnButtonIsTouching.GetPersistentEventCount() > 0 || OnButtonStopTouching.GetNonPersistentListenersCount() > 0)
                {
                    cbraHasEvents = true;
                    CBRADelegatesHolder.IsTouchingEvents.Add(entity, new Action(delegate { OnButtonIsTouching.Invoke(); }));
                }
                if (OnButtonStopTouching.GetPersistentEventCount() > 0 || OnButtonIsTouching.GetNonPersistentListenersCount() > 0)
                {
                    cbraHasEvents = true;
                    CBRADelegatesHolder.StopTouchingEvents.Add(entity, new Action(delegate { OnButtonStopTouching.Invoke(); }));
                }

                // Check if at least one event response was setup
                if (!cbraHasEvents)
                {
                    Debug.LogError("<b>[VRSF] :</b> Please give at least one response to one of the Unity Events for the CBRA on the GameObject " + transform.name, gameObject);
                    entityManager.DestroyEntity(entity);
                    return;
                }

#if UNITY_EDITOR
                // Set it's name in Editor Mode for the Entity Debugger Window
                entityManager.SetName(entity, string.Format("CBRA Entity from GO {0}", transform.name));
#endif
            }


            Destroy(gameObject);
        }
Exemple #7
0
        private void Init(OnSetupVRReady _)
        {
            OnSetupVRReady.UnregisterSetupVRCallback(Init);

            VRInteractionAuthoring interactionParameters = GetComponent <VRInteractionAuthoring>();

            // If the device loaded is included in the device using this CBRA
            if ((interactionParameters.DeviceUsingFeature & VRDF_Components.DeviceLoaded) == VRDF_Components.DeviceLoaded)
            {
                if (interactionParameters.ButtonToUse != EControllersButton.TOUCHPAD)
                {
                    Debug.LogError("<b>[VRDF] :</b> The Fly mode can only be use using the touchpad/thumbstick, as we use the up and down value. Entity won't be created.");
                    Destroy(gameObject);
                    return;
                }
                else if (!InteractionIsUpAndDown(interactionParameters))
                {
                    Debug.LogError("<b>[VRDF] :</b> The Fly mode can only be use using an UP/DOWN combination, as we use them to calculate the direction. Entity won't be created.");
                    Destroy(gameObject);
                    return;
                }

                var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

                var archetype = entityManager.CreateArchetype
                                (
                    typeof(BaseInputCapture),
                    typeof(ControllersInteractionType),
                    typeof(VRRaycastOutputs),
                    typeof(VRRaycastOrigin),
                    typeof(VRRaycastParameters),
                    typeof(FlyAcceleration),
                    typeof(FlyDeceleration),
                    typeof(FlyDirection),
                    typeof(FlySpeed)
                                );

                var flyModeEntity = entityManager.CreateEntity(archetype);

                // Setting up Interactions
                if (!InteractionSetupHelper.SetupInteractions(ref entityManager, ref flyModeEntity, interactionParameters))
                {
                    entityManager.DestroyEntity(flyModeEntity);
                    Destroy(gameObject);
                    return;
                }

                // Setting up Raycasting
                if (!SetupRaycasting(ref entityManager, ref flyModeEntity, interactionParameters))
                {
                    entityManager.DestroyEntity(flyModeEntity);
                    Destroy(gameObject);
                    return;
                }

                // Setup Specific fly mode calculations stuffs
                entityManager.SetComponentData(flyModeEntity, new FlySpeed
                {
                    FlyingSpeedFactor     = this.FlyingSpeedFactor,
                    CurrentFlightVelocity = 0.0f
                });

                entityManager.SetComponentData(flyModeEntity, new FlyDirection());

                entityManager.SetComponentData(flyModeEntity, new FlyAcceleration
                {
                    AccelerationEffectFactor = AccelerationEffect,
                    CurrentFlightVelocity    = 0.0f,
                    TimeSinceStartFlying     = 0.0f
                });

                entityManager.SetComponentData(flyModeEntity, new FlyDeceleration
                {
                    DecelerationEffectFactor = DecelerationFactor,
                    SlowDownTimer            = 0.0f
                });

                // Check for Fly Boundaries
                var flyBoundaries = GetComponent <FlyBoundariesAuthoring>();
                if (flyBoundaries != null)
                {
                    entityManager.AddComponentData(flyModeEntity, new FlyBoundaries
                    {
                        MaxAvatarPosition = flyBoundaries.MaxAvatarPosition,
                        MinAvatarPosition = flyBoundaries.MinAvatarPosition,
                        UseBoundaries     = flyBoundaries.MaxAvatarPosition != Vector3.zero && flyBoundaries.MinAvatarPosition != Vector3.zero
                    });
                }

                if (_destroyEntityOnSceneUnloaded)
                {
                    Core.OnSceneUnloadedEntityDestroyer.CheckDestroyOnSceneUnload(ref entityManager, ref flyModeEntity, gameObject.scene.buildIndex, "FlyModeAuthoring");
                }

#if UNITY_EDITOR
                // Set it's name in Editor Mode for the Entity Debugger Window
                entityManager.SetName(flyModeEntity, "Fly Mode Entity");
#endif
            }

            Destroy(gameObject);
        }
Exemple #8
0
        public void CreateEntity(OnSetupVRReady _)
        {
            OnSetupVRReady.UnregisterSetupVRCallback(CreateEntity);

            var interactionParameters = GetComponent <VRInteractionAuthoring>();

            // If the device loaded is included in the device list using this CBRA
            if ((interactionParameters.DeviceUsingFeature & VRDF_Components.DeviceLoaded) == VRDF_Components.DeviceLoaded)
            {
                var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
                var entity        = entityManager.CreateEntity
                                    (
                    typeof(BaseInputCapture),
                    typeof(ControllersInteractionType),
                    typeof(CBRATag)
                                    );

                // Add the corresponding input, Hand and Interaction type component for the selected button.
                // If the button wasn't chose correctly or any parameter was wrongly set, we destroy this entity and return.
                if (!InteractionSetupHelper.SetupInteractions(ref entityManager, ref entity, interactionParameters))
                {
                    entityManager.DestroyEntity(entity);
                    return;
                }

                // help us check if this CBRA has at least one event. if false, this entity will be destroy.
                bool cbraHasEvents = false;

                if (interactionParameters.InteractionType.HasFlag(EControllerInteractionType.CLICK))
                {
                    // If at least one of the unity event for the click has a persistent listener set in the editor
                    // Add the CBRA Click Events component to the ClickEvents dictionary
                    if (EventHasACallback(OnButtonStartClicking))
                    {
                        cbraHasEvents = true;
                        CBRADelegatesHolder.StartClickingEvents.Add(entity, new Action(delegate { OnButtonStartClicking.Invoke(); }));
                    }
                    if (EventHasACallback(OnButtonIsClicking))
                    {
                        cbraHasEvents = true;
                        CBRADelegatesHolder.IsClickingEvents.Add(entity, new Action(delegate { OnButtonIsClicking.Invoke(); }));
                    }
                    if (EventHasACallback(OnButtonStopClicking))
                    {
                        cbraHasEvents = true;
                        CBRADelegatesHolder.StopClickingEvents.Add(entity, new Action(delegate { OnButtonStopClicking.Invoke(); }));
                    }
                }

                if (interactionParameters.InteractionType.HasFlag(EControllerInteractionType.TOUCH))
                {
                    // If at least one of the unity event for the touch has a persistent listener set in the editor
                    // Add the CBRA Click Events component to the ClickEvents dictionary
                    if (EventHasACallback(OnButtonStartTouching))
                    {
                        cbraHasEvents = true;
                        CBRADelegatesHolder.StartTouchingEvents.Add(entity, new Action(delegate { OnButtonStartTouching.Invoke(); }));
                    }
                    if (EventHasACallback(OnButtonIsTouching))
                    {
                        cbraHasEvents = true;
                        CBRADelegatesHolder.IsTouchingEvents.Add(entity, new Action(delegate { OnButtonIsTouching.Invoke(); }));
                    }
                    if (EventHasACallback(OnButtonStopTouching))
                    {
                        cbraHasEvents = true;
                        CBRADelegatesHolder.StopTouchingEvents.Add(entity, new Action(delegate { OnButtonStopTouching.Invoke(); }));
                    }
                }

                // Check if at least one event response was setup
                if (!cbraHasEvents)
                {
                    Debug.LogError("<Color=red><b>[VRDF] :</b> Please give at least one response to one of the Unity Events for the CBRA on the GameObject.</Color>" + transform.name, gameObject);
                    entityManager.DestroyEntity(entity);
                    return;
                }

                if (_destroyEntityOnSceneUnloaded)
                {
                    OnSceneUnloadedEntityDestroyer.CheckDestroyOnSceneUnload(ref entityManager, ref entity, gameObject.scene.buildIndex, "CBRA");
                }

                // If we use the simulator, we check for a SimulatorButtonProxy. if not null, we add the simulatorButtonProxy script
                if (VRDF_Components.DeviceLoaded == SetupVR.EDevice.SIMULATOR)
                {
                    GetComponent <Simulator.SimulatorButtonProxyAuthoring>()?.AddSimulatorButtonProxy(ref entityManager, ref entity, interactionParameters);
                }

#if UNITY_EDITOR
                // Set it's name in Editor Mode for the Entity Debugger Window
                entityManager.SetName(entity, string.Format("CBRA Entity from GO {0}", transform.name));
#endif
            }

            Destroy(gameObject);
        }
        private void Init(OnSetupVRReady _)
        {
            OnSetupVRReady.UnregisterSetupVRCallback(Init);

            VRInteractionAuthoring interactionParameters = GetComponent <VRInteractionAuthoring>();

            // If the device loaded is included in the device using this CBRA
            if ((interactionParameters.DeviceUsingFeature & VRDF_Components.DeviceLoaded) == VRDF_Components.DeviceLoaded)
            {
                var settings      = GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, null);
                var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;

                var archetype = entityManager.CreateArchetype
                                (
                    typeof(BaseInputCapture),
                    typeof(ControllersInteractionType),
                    typeof(VRRaycastOutputs),
                    typeof(VRRaycastOrigin),
                    typeof(VRRaycastParameters),
                    typeof(CurveTeleporterCalculations),
                    typeof(CurveTeleporterRendering),
                    typeof(ParabolPadsEntities),
                    typeof(ParabolPointsParameters),
                    typeof(ParabolCalculations),
                    typeof(RenderMesh),
                    typeof(GeneralTeleportParameters),
                    typeof(TeleportNavMesh)
                                );

                var teleporterEntity = entityManager.CreateEntity(archetype);

                // Setting up Interactions
                if (!InteractionSetupHelper.SetupInteractions(ref entityManager, ref teleporterEntity, interactionParameters))
                {
                    entityManager.DestroyEntity(teleporterEntity);
                    Destroy(gameObject);
                    return;
                }

                // Setting up Raycasting
                if (!TeleporterSetupHelper.SetupRaycast(ref entityManager, ref teleporterEntity, interactionParameters, 10))
                {
                    entityManager.DestroyEntity(teleporterEntity);
                    Destroy(gameObject);
                    return;
                }

                // Setting up General Teleporter Stuffs
                TeleporterSetupHelper.SetupTeleportStuffs(ref entityManager, ref teleporterEntity, GetComponent <GeneralTeleportAuthoring>());

                // Setup Specific curve teleporter calculations stuffs
                entityManager.SetComponentData(teleporterEntity, new CurveTeleporterCalculations
                {
                    Acceleration    = Acceleration,
                    InitialVelocity = InitialVelocity
                });

                entityManager.SetComponentData(teleporterEntity, new ParabolCalculations {
                    Origin = GetComponent <VRInteractionAuthoring>().ButtonHand
                });

                entityManager.SetComponentData(teleporterEntity, new ParabolPointsParameters
                {
                    PointCount   = PointCount,
                    PointSpacing = PointSpacing
                });

                // Setup Specific curve teleporter rendering stuffs
                var parabolMesh = new Mesh
                {
                    name      = "Parabolic Pointer",
                    vertices  = new Vector3[0],
                    triangles = new int[0]
                };

                parabolMesh.MarkDynamic();

                // This rendermesh is only here to store the mesh, material and layer of the curve teleporter and draw it later in a system
                entityManager.SetSharedComponentData(teleporterEntity, new RenderMesh
                {
                    mesh           = parabolMesh,
                    material       = GraphicMaterial,
                    castShadows    = UnityEngine.Rendering.ShadowCastingMode.Off,
                    layer          = 0,
                    receiveShadows = false,
                    subMesh        = 0
                });

                entityManager.SetComponentData(teleporterEntity, new CurveTeleporterRendering
                {
                    //GraphicMaterial = GraphicMaterial,
                    GraphicThickness = GraphicThickness
                });

                // Create the valid and Invalid Pads
                var selectionPad = GameObjectConversionUtility.ConvertGameObjectHierarchy(SelectionPad, settings);
                var invalidPad   = GameObjectConversionUtility.ConvertGameObjectHierarchy(InvalidPad, settings);

                entityManager.SetEnabled(selectionPad, false);
                entityManager.SetEnabled(invalidPad, false);

#if UNITY_EDITOR
                // Set it's name in Editor Mode for the Entity Debugger Window
                entityManager.SetName(selectionPad, "Curve Teleporter Selection Pad");
                entityManager.SetName(invalidPad, "Curve Teleporter Invalid Pad");
#endif

                entityManager.SetComponentData(teleporterEntity, new ParabolPadsEntities
                {
                    SelectionPadInstance = selectionPad,
                    InvalidPadInstance   = invalidPad
                });

                if (_destroyEntityOnSceneUnloaded)
                {
                    Core.OnSceneUnloadedEntityDestroyer.CheckDestroyOnSceneUnload(ref entityManager, ref selectionPad, gameObject.scene.buildIndex, "CurveTeleporterAuthoring");
                    Core.OnSceneUnloadedEntityDestroyer.CheckDestroyOnSceneUnload(ref entityManager, ref invalidPad, gameObject.scene.buildIndex, "CurveTeleporterAuthoring");
                    Core.OnSceneUnloadedEntityDestroyer.CheckDestroyOnSceneUnload(ref entityManager, ref teleporterEntity, gameObject.scene.buildIndex, "CurveTeleporterAuthoring");
                }

                Destroy(SelectionPad);
                Destroy(InvalidPad);

#if UNITY_EDITOR
                // Set it's name in Editor Mode for the Entity Debugger Window
                entityManager.SetName(teleporterEntity, "Curve Teleporter Entity");
                entityManager.SetName(selectionPad, "Curve Teleporter Valid Pad Entity");
                entityManager.SetName(invalidPad, "Curve Teleporter Invalid Pad Entity");
#endif

                // Create parabol points as entities, as List can't be used in ComponentData
                var pointArchetype = entityManager.CreateArchetype
                                     (
                    typeof(Unity.Transforms.Translation),
                    typeof(ParabolPointParent),
                    typeof(ParabolPointTag)
                                     );

                for (int i = 0; i < PointCount; i++)
                {
                    var parabolPoint = entityManager.CreateEntity(pointArchetype);
                    entityManager.SetSharedComponentData(parabolPoint, new ParabolPointParent {
                        TeleporterEntityIndex = teleporterEntity.Index
                    });
                    if (_destroyEntityOnSceneUnloaded)
                    {
                        Core.OnSceneUnloadedEntityDestroyer.CheckDestroyOnSceneUnload(ref entityManager, ref parabolPoint, gameObject.scene.buildIndex, "CurveTeleporterAuthoring");
                    }
#if UNITY_EDITOR
                    // Set it's name in Editor Mode for the Entity Debugger Window
                    entityManager.SetName(parabolPoint, "Curve Teleporter Point " + i);
#endif
                }
            }

            Destroy(gameObject);
        }