private IEnumerator Start()
        {
            if (TBInput.GetControllerModel(controller) == VRController.None)
            {
                Debug.Log("Input chart was disabled because no controller was found for " + controller + ". This means that the associated ControlType is disabled in TButt's Input Settings, or no compatible controller exists for the current platform.");
                gameObject.SetActive(false);
                yield break;
            }

            controllerLabel.text = controller.ToString() + " | " + TBInput.GetControllerModel(controller).ToString();
            _rect = GetComponent <RectTransform>();

            for (int i = 0; i < buttons.Count; i++)
            {
                if (TBInput.SupportsVirtualButton(buttons[i], controller))
                {
                    CreateDisplayRow(buttons[i]);
                }
            }

            ConformHeights();

            TBInput.ControlType assocaitedControlType = TBInput.ControlType.None;

            switch (controller)
            {
            case TBInput.Controller.LHandController:
            case TBInput.Controller.RHandController:
                assocaitedControlType = TBInput.ControlType.HandControllers;
                break;

            case TBInput.Controller.Mobile3DOFController:
                assocaitedControlType = TBInput.ControlType.Mobile3DOFController;
                break;

            case TBInput.Controller.Gamepad:
                assocaitedControlType = TBInput.ControlType.Gamepad;
                break;

            case TBInput.Controller.ClickRemote:
                assocaitedControlType = TBInput.ControlType.ClickRemote;
                break;
            }

            if (assocaitedControlType != TBInput.GetActiveControlType())
            {
                gameObject.GetComponent <Canvas>().enabled = false;

                while (TBInput.GetActiveControlType() == TBInput.ControlType.None)
                {
                    yield return(null);
                }

                if (assocaitedControlType == TBInput.GetActiveControlType())
                {
                    gameObject.GetComponent <Canvas>().enabled = true;
                }
            }
        }
Esempio n. 2
0
        private void Start()
        {
            if (TBInput.GetControllerModel(controller) == VRController.None)
            {
                Debug.LogWarning("Input chart was disabled because no controller was found for " + controller + ". Is that input type enabled in Input Settings?");
                gameObject.SetActive(false);
                return;
            }

            controllerLabel.text = controller.ToString() + " | " + TBInput.GetControllerModel(controller).ToString();
            _rect = GetComponent <RectTransform>();

            for (int i = 0; i < buttons.Count; i++)
            {
                if (TBInput.SupportsVirtualButton(buttons[i], controller))
                {
                    CreateDisplayRow(buttons[i]);
                }
            }

            ConformHeights();
        }