Search Unity

Oculus Quest button fires multiple events, want on one event on button press

Discussion in 'Input System' started by ChosenZeus, Nov 29, 2020.

  1. ChosenZeus

    ChosenZeus

    Joined:
    May 1, 2014
    Posts:
    18
    Hi,

    I am trying to show/hide an object and When I press B the event fires with every update (by design) How can I make this fire once, OR how can I detect a KEYUP event on this button?

    Code (CSharp):
    1.  
    2.  void FixedUpdate()
    3.     {
    4.         //if (OVRInput.Get(OVRInput.RawButton.B))
    5.         if (OVRInput.Get(OVRInput.Button.Two))
    6.  
    7.         {
    8.                 Text textscript = GameObject.Find("Debug").GetComponentInChildren<Text>();
    9.                 textscript.text = Player_Menu.activeSelf.ToString();
    10.                 Player_Menu.SetActive(!Player_Menu.activeSelf == true);
    11.         }
    12.  
    13.     }
    14.  
    Thanks!
     
    Last edited: Nov 29, 2020
  2. MiguelVieiraAccedo

    MiguelVieiraAccedo

    Joined:
    Jan 21, 2021
    Posts:
    1
    Use "OVRInput.GetDown(OVRInput.Button.Two);" or the equivalent but for up. That "Get" on it's own means just the input in general without any specifics on if it's on keydown or keyup