0 votes
by (350 points)
recategorized by


I use Unity 2019.4.32f
I use Pico G2 4KS
I use Pico XR Plugin 1.2.5

I try to create a gaze input module to be able to select UI with the head.

I already suceed to make it working with XR Controller + XR Ray Interactor with the controller.

I have created another XR Controller + XR Ray Interactor on the head gameobject. And choose "Head" as a XRNode. It works, I can hover UI. But now I am stuck at "Select the hovered UI when you click on the headset button". I don't know which Select Usage I should use Select Usage

I also tried to make a code like :

if(eventSystem.currentSelectedGameObject != null && Input.GetButtonDown("JoystickButton_0"))

but this doesn't work because currentSelectedGameObject is always null

What is the best solution to make a gaze UI module with Unity XR Interaction Toolkit + Pico ?

1 Answer

+1 vote
by (44.8k points)

Dear Developer,

With making a gaze UI module, we recommend the script PXR_UIPointer and you can add the following code to get the UI module:

public GameObject getCurrentTarget()
            return currentTarget;

And you can select UI with the head by :

if (Input.GetKeyDown(KeyCode.JoystickButton0))
            GameObject obj = pointer.getCurrentTarget();
            if (obj!= null)
                //your logic


In addition,there is a demo for you to test:

Hope it helps you.