Ejemplo n.º 1
0
        protected override void OnDetachFromController()
        {
#if UNITY_WSA && UNITY_2017_2_OR_NEWER
            ControllerInfo.SetRenderersVisible(true);

            // Get the touchpad and reassign the original material to it
            Transform touchpad;
            if (ControllerInfo.TryGetElement(MotionControllerInfo.ControllerElementEnum.Touchpad, out touchpad))
            {
                touchpadRenderer          = touchpad.GetComponentInChildren <MeshRenderer>();
                touchpadRenderer.material = originalTouchpadMaterial;
            }

            // Unsubscribe from input
            InteractionManager.InteractionSourceUpdated -= InteractionSourceUpdated;
#endif
        }
Ejemplo n.º 2
0
        protected override void OnAttachToController()
        {
#if UNITY_WSA && UNITY_2017_2_OR_NEWER
            // Turn off the default controller's renderers
            ControllerInfo.SetRenderersVisible(false);

            // Get the touchpad and assign our custom material to it
            Transform touchpad;
            if (ControllerInfo.TryGetElement(MotionControllerInfo.ControllerElementEnum.Touchpad, out touchpad))
            {
                touchpadRenderer          = touchpad.GetComponentInChildren <MeshRenderer>();
                originalTouchpadMaterial  = touchpadRenderer.material;
                touchpadRenderer.material = touchpadMaterial;
                touchpadRenderer.enabled  = true;
            }

            // Subscribe to input now that we're parented under the controller
            InteractionManager.InteractionSourceUpdated += InteractionSourceUpdated;
#endif
        }