- Home /
Raycast a World Space UI with VR (Daydream)
Hello,
need some help with raycasting UI with Daydream. As there are only a demo for gameObjects (cubes), I want to know I can handle UI elements. The UI elements should react as usual, I mean highlighted and so on. The posts in http://stackoverflow.com/questions/39087609/how-to-use-graphic-raycaster-with-worldspace-ui were helpful, but completely.
I used DrawRay to see where my pointer is actually going through and it works good. But no log message is created.
void Update()
{
Quaternion ori = GvrController.Orientation;
Vector3 vector = ori * Vector3.forward;
Debug.DrawRay(transform.position, vector * 100000, Color.green);
PointerEventData pointerData = new PointerEventData(null);
pointerData.position = vector;
Debug.Log(vector);
List<RaycastResult> results = new List<RaycastResult>();
EventSystem.current.RaycastAll(pointerData, results);
if (results.Count > 0)
{
Debug.Log(results[0]);
}
}
Canvas (World Space) and Button is created as useal and not modified.
Thanks for your help!
I'm having the same issue. Were you able to resolve this?
Answer by Tibor0991 · Apr 28, 2017 at 02:50 PM
On the Canvases you should add the "GvrPointerGraphicCaster" component, and disable the "Canvas Graphic Caster" component. Afterwards you should be able to interact with your UI as though as you were using a mouse pointer.
Your answer
Follow this Question
Related Questions
Unity Xr Mesh Raycast,Unity XR Mesh Raycast 0 Answers
XR UIHelpers Eventsystem ray is coming out of my main camera rig instead of my hands 0 Answers
Worldspace Scroll View with Buttons in VR (Gear) 0 Answers
How to access menu button in vive by using steamvr player 1 Answer
Unity 5: How to display bird eye view layout of a 3D scene with UI component overlay on screen? 1 Answer