From 8263edd59284aba390aca011d25b79efecef4c48 Mon Sep 17 00:00:00 2001 From: pryazha Date: Wed, 2 Jul 2025 08:46:23 -0700 Subject: init --- .../Controller/Scripts/ActionToVisibilityISX.cs | 42 ++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/ActionToVisibilityISX.cs (limited to 'Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/ActionToVisibilityISX.cs') diff --git a/Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/ActionToVisibilityISX.cs b/Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/ActionToVisibilityISX.cs new file mode 100644 index 0000000..ab8d7ae --- /dev/null +++ b/Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/ActionToVisibilityISX.cs @@ -0,0 +1,42 @@ +using UnityEngine.InputSystem; + +namespace UnityEngine.XR.OpenXR.Samples.ControllerSample +{ + public class ActionToVisibilityISX : MonoBehaviour + { + [SerializeField] + InputActionProperty m_ActionReference; + public InputActionProperty actionReference { get => m_ActionReference; set => m_ActionReference = value; } + + + [SerializeField] + GameObject m_TargetGameobject = null; + public GameObject targetGameObject { get => m_TargetGameobject; set => m_TargetGameobject = value; } + + private void Start() + { + if (m_ActionReference != null && m_ActionReference.action != null) + m_ActionReference.action.Enable(); + } + + void Update() + { + if (m_TargetGameobject == null) + return; + + if (m_ActionReference != null + && m_ActionReference.action != null + && m_ActionReference.action.controls.Count > 0 + && m_ActionReference.action.enabled == true) + { + m_TargetGameobject.SetActive(true); + return; + } + else + { + // No Matching devices: + m_TargetGameobject.SetActive(false); + } + } + } +} -- cgit v1.2.3-70-g09d2