Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Timvb_97 · Jul 30, 2020 at 02:59 PM · inputvrcontrolleroculus

OVRInput does not work in my script

Hi!

So, I want a GameObject to appear when I touch the A or B button on my right controller. I have an Oculus Quest. I've made a script to make this work, but OVRInput can not be found, Unity doesn't recognize it.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class AppearInventory : MonoBehaviour
 {
     public GameObject Object;
 
 void Update()
     {
         Object.SetActive(false);
 
         if (OVRInput.GetDown(OVRInput.Button.Two))
         {
             StartCoroutine(ShowAndHide(2.0f));
         }
     }
 
     IEnumerator ShowAndHide(float delay)
     {
         yield return new WaitForSeconds(delay);
         Object.SetActive(true);
     }
 }

Does someone help me with my problem? I just want a object to appear after a couple of seconds when I press the A (or B, doesn't matter). I have the Oculus Integration installed as well as the XR Plugin Management. Please someone help me!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by davidcox70 · Jul 30, 2020 at 06:22 PM

If OVRInput isn't found, you probably need to install the Oculus Integration asset. However, you should probably be steered towards using Unity's XR input instead, as this is designed to work with multiple platforms. It will make it easier then to make your app work with non-Oculus products.

Just an observation on your code: you have setActive(false) as the first line on your update routine. This means that the first thing that will happen on every frame is that the referenced object will be made invisible. Although it will be set to be visible after the delay, it will immediately be made invisible again, so you might never see it.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Timvb_97 · Jul 31, 2020 at 09:38 AM 0
Share

I have the Oculus Integration installed and I'm aware of the XR input, but I want to stick with the Oculus integration for now. Anyway, it still doesn't work and my script is still not familiair with OVRInput.

As for the script, it works fine for me actually, don't have problems with that. I set the objects in first instance on false in the hierarchy, so you won't be able to see them in first place.

avatar image davidcox70 Timvb_97 · Jul 31, 2020 at 04:56 PM 0
Share

Did you install Oculus for Android from the Unity Package $$anonymous$$anager window? The way you have your script at the moment, the object will only be visible for one frame at most.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

201 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

VR "Hold" Screen for gallery Instal 0 Answers

XR Interaction Toolkit Preview detecting wrong controller 1 Answer

new input system with open xr/vr only returns digital/binary trigerr values 1 Answer

How to get VR controls working again after update to 2019.1.0f2? 0 Answers

Vive Controller not enabled until mouse click 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges