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 c# - How to use Graphic Raycaster with WorldSpace UI? - Stack Overflow 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!

PS: Maybe @faken or @Umair M reads this and can help.

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.