I made a UI in unity but i’m getting some strange results. I got the feeling the ‘hit’ detection is a bit strange because multiple buttons get ‘selected’ on strange times.
I added a short movie showing a bit of the effect but it is strange and sometimes when I’m not even close to buttons they highlight as if i’m hoovering over them.
See:
It must have something to do with the raycasting / how the input events get handled with Hololens toolkit but I can’t get my head around it.
Anybody any hints / tips to get this working beter? I also have problems with button presses not registering the first time / sometimes have to click multiple times before the button is working.
Thanks already for watching / helping me out!
1 Like
Which version of Unity are you running this project on?
I was running 2017.1.0f3 and just upgraded to 2017.1.1f1 (and upgraded the holotoolkit to the latest release)
I’ve seen this behavior before and never saw the reason until you called it out. I just filed a new bug for it.
I’m guessing you’re recording your screen in Play mode in Editor in the above video? If so, workaround for now for you is move your mouse cursor to the center of your game view when in play mode. The raycast is looking for your mouse position even though it’s drawing the gaze cursor where you’d expect it to, straight in front of you.
I tried your suggestion but can’t see the ‘cursor’ having any impact on the selection of buttons. (I have another movie indeed screen recorded with my phone of the ‘Play mode’.
You don’t exactly see it in the video but I can’t get any influence in what is selected on the screen with my mouse. Is there a way to somehow debug / show the raycasts or anything that is used with the hololens / gui system?
Oh, yes I see your cursor is not doing what I was thinking & hoping.
You can draw rays through Debug.DrawRay.
Are you using the example code by microsoft with the OnSelect() message being sent to objects? If so, you may be sending OnSelect() to an entire hierarchy of objects that have the function; hence, them firing randomly. I had this problem until I was more careful about nesting objects with OnSelect() in them. May or may not help but it was an issue I ran into.
I’m having a similar problem myself, did you ever find a fix to this? My problem is that the spot my cursor is standing over when the UI elements are highlighted is not in line with the the actual UI Elements.
I have the same issue with UI elements. In using the MS example UI, the two buttons are both highlighted at the same time.
If you’re still struggling with the UI feel free to file a new bug and we can take a look at your project specifically. We can then make a better determination if it’s something Unity is doing poorly or HoloLens. If you do submit a new issue, put “[Hololens]” in the title to make it land on our team a bit quicker.
Part of it is because you need to update the event systems horizontal, vertical, submit and cancel buttons
But your particular issue may have been fixed in recent MRTK updates
Thanks for all the replies / for me it seems like my issues (around quirky ui navigation) are fixed in latest MRTK updates. I’m now using Unity 2017.1.2 and the latest MRTK from github.
1 Like