public virtual void OnEnable()
        {
            // We set the buttonActionChoser reference
            _interactionSet = (VRInteractionAuthoring)target;

            _deviceToUse         = serializedObject.FindProperty("DeviceUsingFeature");
            _interactionType     = serializedObject.FindProperty("InteractionType");
            _buttonHand          = serializedObject.FindProperty("ButtonHand");
            _usePositionForTouch = serializedObject.FindProperty("UseThumbPositionForTouch");
            _buttonToUse         = serializedObject.FindProperty("ButtonToUse");

            _touchThumbPosition = serializedObject.FindProperty("TouchThumbPosition");
            _clickThumbPosition = serializedObject.FindProperty("ClickThumbPosition");

            _isTouchingThreshold = serializedObject.FindProperty("IsTouchingThreshold");
            _isClickingThreshold = serializedObject.FindProperty("IsClickingThreshold");
        }
        /// <summary>
        /// Add the corresponding Input component for the selected button.
        /// </summary>
        public static bool AddInputCaptureComponent(ref EntityManager entityManager, ref Entity entity, VRInteractionAuthoring interactionSet)
        {
            // Add the BaseInputCapture component to the entity
            if (entityManager.HasComponent <BaseInputCapture>(entity))
            {
                entityManager.SetComponentData(entity, new BaseInputCapture());
            }
            else
            {
                entityManager.AddComponentData(entity, new BaseInputCapture());
            }

            // Add the specific inputCapture component for our button
            switch (interactionSet.ButtonToUse)
            {
            case EControllersButton.A_BUTTON:
                entityManager.AddComponentData(entity, new AButtonInputCapture());
                return(IsTwoHandOculusDevice() && interactionSet.ButtonHand == EHand.RIGHT);

            case EControllersButton.B_BUTTON:
                entityManager.AddComponentData(entity, new BButtonInputCapture());
                return(IsTwoHandOculusDevice() && interactionSet.ButtonHand == EHand.RIGHT);

            case EControllersButton.X_BUTTON:
                entityManager.AddComponentData(entity, new XButtonInputCapture());
                return(IsTwoHandOculusDevice() && interactionSet.ButtonHand == EHand.LEFT);

            case EControllersButton.Y_BUTTON:
                entityManager.AddComponentData(entity, new YButtonInputCapture());
                return(IsTwoHandOculusDevice() && interactionSet.ButtonHand == EHand.LEFT);

            case EControllersButton.THUMBREST:
                entityManager.AddComponentData(entity, new ThumbrestInputCapture(interactionSet.ButtonHand));
                return(IsTwoHandOculusDevice());

            case EControllersButton.BACK_BUTTON:
                entityManager.AddComponentData(entity, new GoAndGearVRInputCapture());
                return(IsOneHandPortableDevice());

            case EControllersButton.TRIGGER:
                entityManager.AddComponentData(entity, new TriggerInputCapture(interactionSet.ButtonHand));
                return(true);

            case EControllersButton.GRIP:
                entityManager.AddComponentData(entity, new GripInputCapture(interactionSet.ButtonHand));
                return(true);

            case EControllersButton.MENU:
                if (IsTwoHandOculusDevice() && interactionSet.ButtonHand == EHand.RIGHT)
                {
                    Debug.LogError("<b>[VRDF] :</b> Menu button aren't supported on the Right Hand for Two Handed Oculus Devices.");
                    return(false);
                }

                entityManager.AddComponentData(entity, new MenuInputCapture(interactionSet.ButtonHand));
                return(true);

            case EControllersButton.TOUCHPAD:
                // We check that the thumbposition give in the inspector is not set as none
                if (((interactionSet.InteractionType & EControllerInteractionType.TOUCH) == EControllerInteractionType.TOUCH && interactionSet.TouchThumbPosition != EThumbPosition.NONE) ||
                    ((interactionSet.InteractionType & EControllerInteractionType.CLICK) == EControllerInteractionType.CLICK && interactionSet.ClickThumbPosition != EThumbPosition.NONE))
                {
                    entityManager.AddComponentData(entity, new TouchpadInputCapture(interactionSet.UseThumbPositionForTouch));
                    entityManager.AddComponentData(entity, new InteractionThumbPosition
                    {
                        TouchThumbPosition  = interactionSet.TouchThumbPosition,
                        IsTouchingThreshold = interactionSet.IsTouchingThreshold,
                        ClickThumbPosition  = interactionSet.ClickThumbPosition,
                        IsClickingThreshold = interactionSet.IsClickingThreshold
                    });
                    return(true);
                }

                Debug.LogError("<b>[VRDF] :</b> Please Specify valid Thumb Positions to use for your VR Interaction Authoring component.", interactionSet.gameObject);
                return(false);

            default:
                Debug.LogError("<b>[VRDF] :</b> Please Specify valid buttons to use for your VR Interaction Authoring component.", interactionSet.gameObject);
                return(false);
            }
        }
        public static bool SetupInteractions(ref EntityManager entityManager, ref Entity entity, VRInteractionAuthoring interactionParameters)
        {
            // Add the corresponding input component for the selected button. If the button wasn't chose correctly, we destroy this entity and return.
            if (!AddInputCaptureComponent(ref entityManager, ref entity, interactionParameters))
            {
                Debug.Log("<Color=yellow><b>[VRDF] :</b> An error has occur while setting up the Input Capture Component. Please check that the right device is loaded, and your VRInteractionAuthoring parameters.</Color>", interactionParameters.gameObject);
                return(false);
            }

            // If the Hand wasn't chose correctly, we destroy this entity and return.
            if (!AddButtonHand(ref entityManager, ref entity, interactionParameters.ButtonHand))
            {
                return(false);
            }

            // Add the corresponding interaction type component for the selected button. If the interaction type wasn't chose correctly, we destroy this entity and return.
            if (!AddInteractionType(ref entityManager, ref entity, interactionParameters.InteractionType, interactionParameters.ButtonToUse))
            {
                return(false);
            }

            return(true);
        }