NoesisGUI blocking clicks?
Hello,
I have an issue with receiving mouse clicks in Unity's game world. However, for some reason OnMouseEnter() and OnMouseExit() work normally. Whenever I disable NoesisGUIPanel the clicks work again. What could be the problem?
I have an issue with receiving mouse clicks in Unity's game world. However, for some reason OnMouseEnter() and OnMouseExit() work normally. Whenever I disable NoesisGUIPanel the clicks work again. What could be the problem?
-
sfernandez
Site Admin
- Posts: 3154
- Joined:
Re: NoesisGUI blocking clicks?
Hi,
NoesisGUI consumes Unity's events when mouse hits any element of the tree. We do so by calling event.Use() on MouseDown and MouseUp event types, inside the OnGUI message.
What behavior messages are you using that are not working?
NoesisGUI consumes Unity's events when mouse hits any element of the tree. We do so by calling event.Use() on MouseDown and MouseUp event types, inside the OnGUI message.
What behavior messages are you using that are not working?
Re: NoesisGUI blocking clicks?
Hi,
we're using primarily if (Input.GetKeyUp(KeyCode.Mouse0)) clicks while in OnMouseOver(). What baffles me is that we get to OnMouseOver() but the mouse input is not handled at all. For testing I tried also OnMouseDown() which also doesn't work if NoesisGUIPanel is active. Both click methods start working right away if I just disable the NoesisGUIPanel component from the UI Camera.
Edit: if I disable "Enable Mouse" from NoesisGUIPanel, the clicks to gameobjects work. However NoesisGUI buttons etc. don't work obviously anymore.
we're using primarily if (Input.GetKeyUp(KeyCode.Mouse0)) clicks while in OnMouseOver(). What baffles me is that we get to OnMouseOver() but the mouse input is not handled at all. For testing I tried also OnMouseDown() which also doesn't work if NoesisGUIPanel is active. Both click methods start working right away if I just disable the NoesisGUIPanel component from the UI Camera.
Edit: if I disable "Enable Mouse" from NoesisGUIPanel, the clicks to gameobjects work. However NoesisGUI buttons etc. don't work obviously anymore.
-
sfernandez
Site Admin
- Posts: 3154
- Joined:
Re: NoesisGUI blocking clicks?
After experimenting a bit what I noticed is the following:
- OnMouseOver is always received, even if mouse is over Noesis elements.
- OnMouseEnter/OnMouseExit is always received, even if mouse is over Noesis elements.
- OnMouseDown/OnMouseUp are only received if mouse is not clicked over Noesis elements. I guess this should be expected. What is strange is that when mouse is clicked over Noesis elements, an OnMouseExit followed by OnMouseEnter occurs, and I don't understand why Unity does that.
- Input.KeyUp(KeyCode.Mouse0) is only true if mouse is not clicked over Noesis elements.
Code: Select all
<Grid Background="#80000000" IsHitTestVisible="False">
...
</Grid>
Re: NoesisGUI blocking clicks?
Hello,
Esses and me work on same project so I elaborate our xaml hierarchy a bit.
We have "MainEditor.xaml" which contains
All of those tabitems are our own usercontrols which looks something like this
Here you can see element "Viewport" which is present on all of our individual editors.
Viewport is just
This viewport is just what Unity is rendering. In our case, just making viewport's prop IsHitTestVisible to false will not fix our issue because there is always some element which catches viewport click.
I'm wondering if we are doing something wrong because if you use Noesis in Unity there is always some "root" element present which is obviously always catching Unity's mouse click events so obviously there is something wrong with our project...?
Here is image of the actual ability editor where you can see how the viewport looks
Update:
After investigating a bit this it looks like TabControl from MainEditor is somehow capturing click event.
I'm quite sure this is a bug, if your customer wants to use TabControl in Unity while still being able to click on unity objects, it's not possible at this moment
Repro: Open your primitives sample scene, open primitives.xaml
Group Grid named "layoutroot" to TabControl and make TabControls background transparent and make "layoutroot" as TabItem of this TabControl. Obviously you can't anymore click on primitive objects because this TabControl is consuming clicks.
Esses and me work on same project so I elaborate our xaml hierarchy a bit.
We have "MainEditor.xaml" which contains
All of those tabitems are our own usercontrols which looks something like this
Here you can see element "Viewport" which is present on all of our individual editors.
Viewport is just
Code: Select all
<Grid x:Name="Viewport" Background="Transparent" />
I'm wondering if we are doing something wrong because if you use Noesis in Unity there is always some "root" element present which is obviously always catching Unity's mouse click events so obviously there is something wrong with our project...?
Here is image of the actual ability editor where you can see how the viewport looks
Update:
After investigating a bit this it looks like TabControl from MainEditor is somehow capturing click event.
I'm quite sure this is a bug, if your customer wants to use TabControl in Unity while still being able to click on unity objects, it's not possible at this moment
Repro: Open your primitives sample scene, open primitives.xaml
Group Grid named "layoutroot" to TabControl and make TabControls background transparent and make "layoutroot" as TabItem of this TabControl. Obviously you can't anymore click on primitive objects because this TabControl is consuming clicks.
-
sfernandez
Site Admin
- Posts: 3154
- Joined:
Re: NoesisGUI blocking clicks?
Following the Primitives sample I was able to reproduce your problem and I found a bug in our hit testing algorithm when using a certain type of geometries.
While we fix this bug, if you are using NoesisStyle.xaml you can modify the TabControl template as follows:
- In line 3133, add to the Border "BaseBorder" the property IsHitTestVisible="False".
- In line 3139, add to the Border "DisabledBorder" the property IsHitTestVisible="False".
Then, if you set the TabControl.Background="{x:Null}" it won't catch mouse clicks.
Let me know if you need help with the workaround.
While we fix this bug, if you are using NoesisStyle.xaml you can modify the TabControl template as follows:
- In line 3133, add to the Border "BaseBorder" the property IsHitTestVisible="False".
- In line 3139, add to the Border "DisabledBorder" the property IsHitTestVisible="False".
Then, if you set the TabControl.Background="{x:Null}" it won't catch mouse clicks.
Let me know if you need help with the workaround.
- [email protected]
- Posts: 19
- Joined:
Re: NoesisGUI blocking clicks?
Thanks, the {x:Null} background fixed the problem for me :)
Who is online
Users browsing this forum: No registered users and 1 guest