summaryrefslogtreecommitdiff
path: root/Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/ActionToVisibilityISX.cs
diff options
context:
space:
mode:
authorpryazha <pryadeiniv@mail.ru>2025-07-02 08:46:23 -0700
committerpryazha <pryadeiniv@mail.ru>2025-07-02 08:46:23 -0700
commit8263edd59284aba390aca011d25b79efecef4c48 (patch)
tree6346e2afaaabd32156601cafaf20d4ee813befaf /Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/ActionToVisibilityISX.cs
Diffstat (limited to 'Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/ActionToVisibilityISX.cs')
-rw-r--r--Assets/Samples/OpenXR Plugin/1.14.3/Controller/Scripts/ActionToVisibilityISX.cs42
1 files changed, 42 insertions, 0 deletions
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);
+ }
+ }
+ }
+}