Home › Forums › Software Development › Unity UI Gaze Aware Button
- This topic has 6 replies, 4 voices, and was last updated 5 years, 7 months ago by Alex [Tobii].
- 06/03/2017 at 15:25 #6413Calum TimpanyParticipant
I’m wondering if there is any way to set up a button in Unity to be gaze aware. Essentially what i’m trying to do is to be able to interact with a button using gaze like you would with a mouse (i.e. look at the button, and then click to have it perform whatever action it is set to do).
From looking at other forum posts it looks like this was possible to do in the past, but i’m assuming after Unity change how UI works that this changed.
I’m relatively new to using the Unity SDK, only having started using it this year as part of a University project, so apologies if there is a very straightforward way of doing this that I’ve managed to miss.
If it is still possible to make a gaze aware button then I would appreciate if someone could explain how to to this. If it is not possible it would be useful if someone could explain why this is the case, as this would be something I could include in my final report.20/03/2017 at 17:24 #6527
Currently we support gaze aware components only for 3d objects. But you can definitely compare gaze coordinates with ui element bounds to make it gaze aware.
Please make sure to use some filtering/stickiness and add margins to you UI button bounds. It’s also probably not the best use case for eye tracking if we are talking about game features.30/07/2017 at 20:47 #7220jayParticipant
so there is not a simple solution for interacting with ui elements?31/07/2017 at 11:55 #7223
Not as easy as drag n’ drop component at the moment. But it’s on our backlog.
As I mentioned before, you can just check if gaze point is within the bounds, or use 3D gaze aware objects.31/07/2017 at 17:37 #7224Chris HoopesParticipant
I actually just implemented this the other day. Easiest way to do it is get the coordinates of the gaze point and use Unity’s UI Graphic Raycaster to figure out what elements they’re looking at and then act on them.
https://docs.unity3d.com/ScriptReference/UI.Graphic.Raycast.html01/08/2017 at 02:26 #7227jayParticipant
thanks. I was able to accomplish what I wanted to do with Clean UI.01/08/2017 at 11:59 #7228
If you do raycasts for UI, it’s important to use some scoring to reduce flickering.
- You must be logged in to reply to this topic.