(New GUI) Make elements ignore mouse?

I ran a search for this but couldn’t find anything, as most of the questions and answers pertained to the old GUI system rather than the new one.

That being said, is there any way to tell an element of the new GUI to ignore the mouse all-together? I’m not just talking about ignoring mouse clicks, but even ignoring the mouse’s position.

The reason I ask is because I’m trying to design a tooltip that simply consists of a panel with text inside it. The tooltip only becomes visible when the cursor hovers over a button, at which point it’s constantly updated to match the mouse’s position (and nudged over a bit on the X axis).

The problem I’m having with this approach is that since the mouse cursor moves a little quicker than the tooltip’s position updates, you’re sometimes able to cover the tooltip before it gets out of the way, which in turn also covers the button (and, for that split second, prevents the button from being clicked!). This isn’t a game breaker since it does eventually get out of the way, but it’s annoying nonetheless.

I also tried removing the tooltip’s panel so that it consisted only of text, thinking that perhaps the panel itself was the culprit, but unfortunately text appears to “block” the cursor as well.

If anyone knows of a way to keep the new GUI elements from registering the mouse’s position or even an obscure workaround, I would greatly appreciate it!

Thank you in advance!

Have you tried Interactable toggle?

@fafase: It looks like neither panels nor text elements feature an "Interactable" property by default, so unless I'm missing something that option isn't available.

2 Answers

2

I was just given the solution by one of Unity’s developers on the forum.

To make a canvas or one of its elements completely ignore all mouse input, simply add a Canvas Group component to that canvas or element (Add Component->Layout->Canvas Group), then turn off Blocks Raycasts.

Great thanks! This is especially helpful when using UI in VR when I don't want the mouse to accidentally highlight or select elements.

You should also ask in the Beta group where our developers can help.