Home › Forums › Software Development › GUI Button and Gaze Aware › Reply To: GUI Button and Gaze Aware
Hi Richard,
The GazeAwareComponent only works with game object’s that have either a BoxCollider
or Renderer
we can use to calculate the object’s projected bounds on the screen.
With GUI buttons you have to do more manual work to get them GazeAware.
Check out the ActivatableGUI demo scene included in the EyeX SDK for Unity package. It shows how to attach the EyeXActivatable behavior to a GUI.button (in TitleGUI.cs). I guess this should be very similar how you would do it with a GUI.RepeatButton.
Instead of adding the EyeXActivatable behavior to the button interactor, you add the EyeXGazeAware behavior:
repeatButtonInteractor.EyeXBehaviors.Add(new EyeXGazeAware() { DelayTime = delayInMilliseconds });
When all is setup, you will be able to read if the player is looking at the button by checking if repeatButtonInteractor.HasGaze()
.