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

Bug No tooltips with 2022.2.1 update

Discussion in 'UI Toolkit' started by Destruxion, Dec 19, 2022.

  1. Destruxion

    Destruxion

    Joined:
    Jun 5, 2019
    Posts:
    22
    Hey,

    I recently upgraded to 2022.2.1 and now tooltips that worked fine before will not show up anymore.

    Just downgraded the project to 2022.2.0 to verify they work with that version.

    Has anything been changed we need to take care of now or is this a bug?
     
  2. C-UITools

    C-UITools

    Unity Technologies

    Joined:
    Jun 23, 2021
    Posts:
    22
    Hello,

    Could you provide additional details?
    • Are these your custom tooltips that you wrote for your project? Or are these tooltips the ones in the UI Builder?
    • Do you do any custom event handling on the tooltip?
    • Could you provide a code example of how you set the tooltip?

    Thank you!
     
  3. Destruxion

    Destruxion

    Joined:
    Jun 5, 2019
    Posts:
    22
    I set the tooltip when creating the visual element in C#. Actually everything (custom node graph) is done in C# without any style files.

    This is the actual code:

    Code (CSharp):
    1. Label = new Label();
    2. Label.name = "Attribute Label";
    3. Label.text = label;
    4. Label.style.width = NodeElement.Node.GetDefaultLabelWidth();
    5. Label.style.unityTextAlign = Attribute.LabelTextAnchor;
    6. Label.style.alignSelf = Align.Stretch;
    7. Label.style.overflow = Overflow.Hidden;
    8. Label.style.marginRight = -3;
    9. Label.tooltip = CreateTooltip();
    10. Label.RegisterCallback<PointerDownEvent>( LabelPointerDownHandler );
    CreateToolip() uses a StringBuilder to create the actual tooltip string, which contains some rich text flags (size and color). Now that I know it works with 2022.2.0 I can switch back to 2022.2.1 and see if the PointerDownEvent or rich text has any impact.


    upload_2022-12-19_22-16-3.png
     
  4. Destruxion

    Destruxion

    Joined:
    Jun 5, 2019
    Posts:
    22
    Removing the callback and changing the tooltip to a fixed string has no impact. The tooltip is still not showing up using 2022.2.1.

    Code (CSharp):
    1. Label.tooltip = "ABC";
    2. //Label.RegisterCallback<PointerDownEvent>( LabelPointerDownHandler );
     
  5. vonchor

    vonchor

    Joined:
    Jun 30, 2009
    Posts:
    238
    I just discovered the exact same problem a few minutes ago. Custom-coded UIElements where I set the tooltip worked in 2022.1 but no longer. No rich text involved, just stuff like:

    Code (CSharp):
    1. public TpImageToggle(Action<bool> callback,
    2.                          string                           name,
    3.                          string                           tooltip,
    4.                          float                            height,
    5.                          Texture2D                        icon
    6.                          )
    7.     {
    8.      
    9.         this.callback      = callback;
    10.         this.name          = name;
    11.         this.tooltip       = tooltip;
    12.         ..... etc
    13.  
    14.  
    Not a single tooltip works.

    Incidentally, this project includes an IMGUI element, and tooltips from IMGUI code work properly, although I'm sure that this is irrelevant.

    If it helps, UI builder was not involved at all, I don't use it.
     
  6. Lars-Blaabjerg

    Lars-Blaabjerg

    Joined:
    Apr 5, 2011
    Posts:
    54
    I am experiencing a similar issue. I have made a custom property drawer using IMGUI, and after upgrading Unity from 2020.3.40f1 to 2022.2.6f1 some of the tooltips have stopped working.
    It seems like only the tooltip on the first line drawn stopped working.
    They are all made the same way, like this:
    Code (CSharp):
    1. EditorGUI.LabelField(fieldRect, new GUIContent(desc.description, desc.longDescription));
    2.