Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

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