WorldSpaceUI Question - Click Events
I am using the WorldSpaceUI element and it nearly completely works... I am seeing MouseOver events fire with accurate cursor precision. However, Click and MouseDown events are not firing. I dissected the WorldSpaceUI example but I'm at a loss for what I might be missing.
- The NoesisView has mouse events enabled.
- There is no occlusion from other UI elements, and I am not seeing other elements grab the event.
- No success with triggers or code behind events, i.e. click or mousedown.
- The NoesisView has mouse events enabled.
- There is no occlusion from other UI elements, and I am not seeing other elements grab the event.
- No success with triggers or code behind events, i.e. click or mousedown.
Re: WorldSpaceUI Question - Click Events
Do you have actions enabled on the view? (and probably the new input system).
Re: WorldSpaceUI Question - Click Events
OK, the cause is interesting.
I render camera output to a texture and composite this texture into the Noesis View. Let's call this UI my base layer. The camera depth is 10.
I render world space UI elements using a separate Noesis View. Here the camera depth is 2. This allows UI elements to render over the World Space UI.
When the base layer has Enable Mouse checked, the World Space UI elements receive mouse over events but not click.
When the base layer has Enable Mouse unchecked, the World Space UI elements receive click events.
I would just disable the base layer Enable Mouse property but my game UI resides at this level.
Does this make sense? The base UI is on the right side -- and it works. The world space ui element is the green arrows. Orange indicates a mouse over state. It isn't clickable.
I render camera output to a texture and composite this texture into the Noesis View. Let's call this UI my base layer. The camera depth is 10.
I render world space UI elements using a separate Noesis View. Here the camera depth is 2. This allows UI elements to render over the World Space UI.
When the base layer has Enable Mouse checked, the World Space UI elements receive mouse over events but not click.
When the base layer has Enable Mouse unchecked, the World Space UI elements receive click events.
I would just disable the base layer Enable Mouse property but my game UI resides at this level.
Does this make sense? The base UI is on the right side -- and it works. The world space ui element is the green arrows. Orange indicates a mouse over state. It isn't clickable.
Last edited by stonstad on 08 Dec 2023, 21:06, edited 1 time in total.
Re: WorldSpaceUI Question - Click Events
It seems your base UI is intercepting the mouse (click) events. A view is "consuming" click events when HitTest returns a non-null instance:
To confirm this, you could remove the ev.Use() line and everything should work. But that's not the right solution.
It seems your base UI is taking the whole space and always returning non-null for HitTest. I am not sure why this is happening but anyways we should be able to be smarter and only consume the event if the view really processed the event (not when hit testing returns non-null).
Do you think you could create a small repro case of this scenario?
Code: Select all
if (HitTest(mouse.x, mouse.y))
{
ev.Use();
}
It seems your base UI is taking the whole space and always returning non-null for HitTest. I am not sure why this is happening but anyways we should be able to be smarter and only consume the event if the view really processed the event (not when hit testing returns non-null).
Do you think you could create a small repro case of this scenario?
Re: WorldSpaceUI Question - Click Events
I can confirm that commenting out ev.use resolves the issue. I can confirm that all intermediate layers are transparent or disabled for hit test. My current work-around to fix click events is to check for mouse over within the world space UI (which works), and then disable the base view's Enable Mouse property. A click event can then be received, and then I re-enable Mouse Enabled on mouse up. It's a total hack. I'm not sure what a reproduction project looks like -- Stellar is pretty involved at this point.
Camera, Depth 1 -> Cosmos
Camera, Depth 2 -> World Space UI
Camera, Depth 3 -> Player Camera
Camera, Depth 4 -> Base UI
Camera, Depth 1 -> Cosmos
Camera, Depth 2 -> World Space UI
Camera, Depth 3 -> Player Camera
Camera, Depth 4 -> Base UI
Re: WorldSpaceUI Question - Click Events
Could you please create a ticket for this? I am not sure right now if we should remove ev.Use() from the code, because there are other parts (Mouse movement as you discovered, or gamepad actions) that totally ignore it.
Who is online
Users browsing this forum: No registered users and 3 guests