8 using UnityEngine.Events;
12 namespace Valve.VR.InteractionSystem
15 [RequireComponent( typeof( Interactable ) )]
20 private Hand currentHand;
25 Button button = GetComponent<Button>();
28 button.onClick.AddListener( OnButtonClick );
34 private void OnHandHoverBegin(
Hand hand )
37 InputModule.instance.HoverBegin( gameObject );
38 ControllerButtonHints.ShowButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger );
43 private void OnHandHoverEnd(
Hand hand )
45 InputModule.instance.HoverEnd( gameObject );
46 ControllerButtonHints.HideButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger );
52 private void HandHoverUpdate(
Hand hand )
54 if ( hand.GetStandardInteractionButtonDown() )
56 InputModule.instance.Submit( gameObject );
57 ControllerButtonHints.HideButtonHint( hand, Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger );
63 private void OnButtonClick()
65 onHandClick.Invoke( currentHand );
71 [UnityEditor.CustomEditor( typeof(
UIElement ) )]
72 public class UIElementEditor : UnityEditor.Editor
77 public override void OnInspectorGUI()
79 DrawDefaultInspector();
82 if ( GUILayout.Button(
"Click" ) )
84 InputModule.instance.Submit( uiElement.gameObject );