Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

OVRInput.GetDown not working on Touch controllers in unity?

GnimmelGnimmel Posts: 15
Brain Burst
I am having a hard time getting the buttons to work reliably on the oculus touch controllers in unity.

If I use if OVRInput.GetDown it never seems to work, but using OVRInput.Get works all the time?

I wasn't sure if it was something to do with OVRInput.Update (); and I've tried adding it to 1 script and all the scripts that detect input but both ways give the same results, .GetDown will not work, but .Get will?

Is there a step I'm missing?

Comments

  • artman41artman41 Posts: 1
    NerveGear
    I can also confirm this issue. Currently on Unity 2017.1.0f3 with the latest oculus sdk (from the unity store).

    OVRInput.GetUp() and OVRInput.GetDown() always return false, with OVRInput.Get() being the only way of detecting if a key is down.

    I can post a copy of my project if you wish to take a look.
  • LivingValkyrieLivingValkyrie Posts: 4
    NerveGear
    has there been any news on this? im also having the same problem, ive spent over two hours this morning testing with different sdk versions and unity version combinations and still no luck
  • TheDigitalNinja2TheDigitalNinja2 Posts: 1
    NerveGear
    Still happening. 
  • gb3724gb3724 Posts: 1
    NerveGear
    Hi any further update or fix to this? Happening to me as well. Thanks. 
  • Chimer0sChimer0s Posts: 4
    NerveGear
    Still happening as of May 2019 with Unity 2018.4, been persistent on all versions I've tried as well.
  • mogacreativemogacreative Posts: 11
    NerveGear
    edited May 2019
    Gnimmel said:
    I am having a hard time getting the buttons to work reliably on the oculus touch controllers in unity.

    If I use if OVRInput.GetDown it never seems to work, but using OVRInput.Get works all the time?

    I wasn't sure if it was something to do with OVRInput.Update (); and I've tried adding it to 1 script and all the scripts that detect input but both ways give the same results, .GetDown will not work, but .Get will?

    Is there a step I'm missing?
    if (OVRInput.GetDown(OVRInput.Button.Two)) { DoWhateverYouWant(); }
  • BaseDropBaseDrop Posts: 1
    NerveGear
    Still happening as of December 2019 with Unity 2019.3.0b7
  • samuraifictionsamuraifiction Posts: 3
    NerveGear
    Same issue here. And also in the Unity Input Debugger, only position/rotations things are working. No Button ;/
  • samuraifictionsamuraifiction Posts: 3
    NerveGear
    funny: with the Quest via Link, all works fine.  But with a Rift not
  • sivandan2000sivandan2000 Posts: 1
    NerveGear
    Still happening in 2019.5f1. I cant seem to find the problem.. Any workaround?
  • SentientDragon5SentientDragon5 Posts: 2
    NerveGear
    Still happening in 2019.3.15f1 
    I made my own function for this and it seems to be working with both the button press of the Start button and the hand tracking version (left hand palm index to thumb) and Got this to work:

        public OVRInput.Button pauseButton = OVRInput.Button.Start;
       
        public GameObject pauseEffect;

        public bool GameIsPaused = false;

        private bool pressedLastFrame = false;
        private bool pressedThisFrame = false;
        
        void Update()
        {
            // call these two if you want OVR controller Input
            OVRInput.Update();
            OVRInput.FixedUpdate();

            //pressedThisFrame will only be triggered like GetButtonDown, and pressedLastFrame will remain true until you stop pressing the specified button.
            pressedThisFrame = OVRInput.Get(pauseButton) && !pressedLastFrame;
            
            if (pressedThisFrame)
            {
                if (!GameIsPaused)
                {
                    Pause();
                }
                else if (GameIsPaused)
                {
                    Resume();
                }
            }

            pressedLastFrame = OVRInput.Get(pauseButton);
            pauseEffect.SetActive(GameIsPaused);
        }

    Hope this helps!
  • dangerEn94dangerEn94 Posts: 1
    NerveGear
    This is still happening in 2020... What is taking so long to fix???
  • kavanbahramikavanbahrami Posts: 5
    NerveGear
    unity 2020.1.5 + latest everything else on Quest, same issue
  • DavidW-MRDavidW-MR Posts: 1
    NerveGear
    I was having this issue too, for me the issue was that I was calling OVRInput.Update and OVRInput.FixedUpdate in one of my own scripts, but these are already called by OVRManager.  The documentation implies you need to include OVRManager and call those functions, but I think they mean to do either/or.
  • zdh3110zdh3110 Posts: 3
    NerveGear
    Same issue on my end in all of the following four cases: Unity 2019.4.11+
    1. Legacy Unity XR SDK + Oculus Rift link (run in editor)
    2. Legacy Unity XR SDK + Oculus Quest (apk)
    3. New Unity XR SDK + Oculus Rift link (run in editor)
    4. New Unity XR SDK+ Oculus Quest (apk)
  • eoventoeovento Posts: 10
    Brain Burst
    DavidW-MR said:
    I was having this issue too, for me the issue was that I was calling OVRInput.Update and OVRInput.FixedUpdate in one of my own scripts, but these are already called by OVRManager.  The documentation implies you need to include OVRManager and call those functions, but I think they mean to do either/or.
    Thank you VERY much, Sir, This one fixed it for me.

    Was I doing it wrong since ever?... Documentation clearly says:

    • Include an instance of OVRManger anywhere in your scene.
    • Call OVRInput.Update() and OVRInput.FixedUpdate() once per frame at the beginning of any component’s Update and FixedUpdate methods, respectively.
    So I was doing both "requirements"... placing OVRManager in the Scene AND calling both Update and FixedUpdate from a script I made. GetDown wasn't working, and as soon as I removed both calls from my script, it started working.

    (Quest 1, Unity 2019.3.15)
  • zdh3110zdh3110 Posts: 3
    NerveGear
    DavidW-MR said:
    I was having this issue too, for me the issue was that I was calling OVRInput.Update and OVRInput.FixedUpdate in one of my own scripts, but these are already called by OVRManager.  The documentation implies you need to include OVRManager and call those functions, but I think they mean to do either/or.
    eovento said:
    DavidW-MR said:
    I was having this issue too, for me the issue was that I was calling OVRInput.Update and OVRInput.FixedUpdate in one of my own scripts, but these are already called by OVRManager.  The documentation implies you need to include OVRManager and call those functions, but I think they mean to do either/or.
    Thank you VERY much, Sir, This one fixed it for me.

    Was I doing it wrong since ever?... Documentation clearly says:

    • Include an instance of OVRManger anywhere in your scene.
    • Call OVRInput.Update() and OVRInput.FixedUpdate() once per frame at the beginning of any component’s Update and FixedUpdate methods, respectively.
    So I was doing both "requirements"... placing OVRManager in the Scene AND calling both Update and FixedUpdate from a script I made. GetDown wasn't working, and as soon as I removed both calls from my script, it started working.

    (Quest 1, Unity 2019.3.15)
    You two are right and thanks a lot! This issue was solve on my end by removing the Update() calls. For future people who have the same issue, I'm not using FixedUpdate(), but try to remove that too and check if that'll work.
  • rkachachrkachach Posts: 1
    NerveGear
    edited January 14
    Thank you very much. I spent a lot of time trying to figure out what's wrong it turnet out I have an OVRInput.Update() call in one of my scripts. I removed it and everything started to work like a charm :smile:

Sign In or Register to comment.