public void RemoveInputSource(TriggerEventInputSource inputSource)
 {
     if (registeredInputSourceList.Contains(inputSource))
     {
         registeredInputSourceList.Remove(inputSource);
     }
 }
        //override unity's event system with our custom cameras
        protected override void Start()
        {
            //get cursor to reference
            cursorParent = EventSystemManager.Instance.cursor;

            //add default if it is not set in editor
            if (currentInputSource == null)
            {
                Debug.LogError("Missing InputSource in StandaloneXRInputModule.cs", gameObject);
                currentInputSource = FindObjectOfType <TriggerEventInputSource>();
            }

            //force gathering of references to avoid null errors
            currentInputSource.Awake();

            if (customInput == null)
            {
                //override our input
                customInput = gameObject.AddComponent <CustomInput>();
                customInput.controllerCameraRay = currentInputSource.eventCamera;
                base.Start();
            }



            // isReady = true;
        }
        public void RemoveInputSourceWithoutClick(TriggerEventInputSource inputSource)
        {
            //set click event for our lazer if it is on top of a UI component when disabling
            // xrStandaloneInput.SetTriggerForClick();

            //set appropriate trigger hand active
            if (inputSource_LeftHand == inputSource)
            {
                //only change input when other lazer is on, if not keep it within the current hand
                if (!inputSource_RighttHand.gameObject.activeInHierarchy)
                {
                    return;
                }

                //set alternate camera for input
                foreach (var canvas in canvasesToReceiveEvents)
                {
                    canvas.worldCamera = inputSource_RighttHand.eventCamera;
                }

                //set linerenderer to use for line to UI interactions
                xrStandaloneInput.RegisterInputSource(inputSource_RighttHand);

                //remove this input source
                xrStandaloneInput.RemoveInputSource(inputSource);
            }
            else if (inputSource_RighttHand == inputSource)
            {
                //only change input when other lazer is on, if not keep it within the current hand
                if (!inputSource_LeftHand.gameObject.activeInHierarchy)
                {
                    return;
                }

                foreach (var canvas in canvasesToReceiveEvents)
                {
                    canvas.worldCamera = inputSource_LeftHand.eventCamera;
                }



                //set linerenderer to use for line to UI interactions
                xrStandaloneInput.RegisterInputSource(inputSource_LeftHand);

                //remove this input source
                xrStandaloneInput.RemoveInputSource(inputSource);
            }
        }
        //  [ShowOnly]public bool isReady;
        /// <summary>
        /// Set CameraEvent Source for processing ui detection and line rendering updating
        /// </summary>
        /// <param name="eventCamera"></param>
        public void RegisterInputSource(TriggerEventInputSource inputSource, bool setAsCurrentInputSource = true)//Camera eventCamera)
        {
            if (inputSource == null)
            {
                throw new System.Exception("inputSource was null in RegisterInputSource in StandaloneInputModuleXR.cs");
            }



            //dont alternate to inactive input source
            //if (!inputSource.gameObject.activeInHierarchy) {
            //    return;
            //}

            if (customInput == null)
            {
                customInput = gameObject.AddComponent <CustomInput>();
                customInput.controllerCameraRay = inputSource.eventCamera;
                //throw new System.Exception("Custom Input was null for StandaloneInputModuleXR.cs");
                base.Start();
            }

            current_inputSourceGO = inputSource.gameObject;

            //change our input camera source
            customInput.controllerCameraRay = inputSource.eventCamera;

            //add any new registered sources to give default values to when not active
            if (!registeredInputSourceList.Contains(inputSource))
            {
                registeredInputSourceList.Add(inputSource);
            }

            if (setAsCurrentInputSource)
            {
                currentInputSource = inputSource;

                //set our canvas to receive input from our activated hand
                foreach (var canvas in EventSystemManager.Instance.canvasesToReceiveEvents)
                {
                    canvas.worldCamera = inputSource.eventCamera;
                }
            }
        }