Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

(uGUI) Make elements ignore mouse?

Discussion in 'UGUI & TextMesh Pro' started by Chubzdoomer, Oct 9, 2014.

  1. Chubzdoomer

    Chubzdoomer

    Joined:
    Sep 27, 2014
    Posts:
    105
    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!
     
    timyrlanforforum likes this.
  2. Tim-C

    Tim-C

    Unity Technologies

    Joined:
    Feb 6, 2010
    Posts:
    2,181
    Add a canvas group and set blocks raycasts to false :)
     
    IIoyd, DINOPLAY, ffxiangyu and 3 others like this.
  3. Chubzdoomer

    Chubzdoomer

    Joined:
    Sep 27, 2014
    Posts:
    105
    That did it! Thank you!