SteamVR and canvas interaction?
I am starting out using SteamVR V2.2.0 and I am having trouble finding a tutorial on how to point a controller at a world-space UI and interact with it.
Does anyone know of a tutorial that works well with world space UIs and SteamVR?
Answer by inbal · Aug 13, 2019 at 10:41 AM
Hi, Need your help about the UI Interaction: (Unity 2019.2, SteamVR 2.2, Oculus S)
I work with UI Buttons, and it's work ok But when I add them a Scrollbar, the scrollbar doesn't move it's self and the UI Buttons that Content to him. Am I missing something here or it has to be the same action that I do with the UI Buttons with add box collider & UI Element when I'm using the UI Objects with steam VR Thank's Inbal
Answer by unity_J016ZU_VZQzYAg · Feb 22, 2019 at 07:47 PM
1. Create a normal button
2. add a box collider component to it
3. scale the box collider to fit the button (depth needs be > 0).
4. add the interactable script component
5. add the UIElement script component
6. add functions to the UIElement event box.
Thanks for the reply, I gave it a try and then realized that I forgot to mention I was trying to get this working on a laser pointer. I have since imported the Vive Input Utility from the asset store that provides the desired UI interaction, but again a big thank you :)
Should also work with the laserpointer script that S$$anonymous$$mVR 2.2.0 provided
Hi Unity_j I implemented these steps with the normal S$$anonymous$$m_VR_Laser_Pointer.
Added the button. Added a box collider with a depth greater than 0. Scaled the box collider. Added the Interact-able script to the Button. Added the UIElement script to the button. Added a function to the On Hand Click event.
The problem I am getting is that nothing happens when I click, the laser is colliding with the Box collider but no click event is being generated.
In the UIElement component there is a click button in the inspector, when i click this I get a NullReferenceException on UIElement.cs:84 of UIElement.cs
Adding the Valve.VR.InteractionSystem to my Event system as an input $$anonymous$$odule stops this error, but doesn't fix the event not being received by my script.
??
Hi~ do you know how to make "Slider" works as well? I tried your steps, but it doesn't work. I could see the yellow hint to pull the trigger (as shown below), but the slider does not move with my hand after I do so. Do you know what might be the problem? Thanks!
Curve UI - Work Perfect With S$$anonymous$$m VR 2 assetstore.unity.com/packages/tools/gui/curved-ui-vr-ready-solution-to-bend-warp-your-canvas-53258
Your answer
Follow this Question
Related Questions
Block some raycasts from world space canvas and ignore others? 0 Answers
Laser pointer style UI interaction in VR 2 Answers
Rendering a Canvas as Screen Space - Camera - Google Cardboard 0 Answers
Block physics raycast on gameobjects if UI element was clicked 3 Answers
Activate Button only by looking at it? 0 Answers