NaughtyAttributes icon indicating copy to clipboard operation
NaughtyAttributes copied to clipboard

[Issue] Unity's "Space" and "Tooltip" attributes can't be combined with some of the Naughty attributes

Open dbrizov opened this issue 7 years ago • 16 comments
trafficstars

dbrizov avatar Feb 18 '18 17:02 dbrizov

When tooltips didn't work for me on the MinMaxSlider I edited the MinMaxPropertyDrawer in the following way:

EditorGUI.LabelField(labelRect, property.displayName); // line 48

... became ...

TooltipAttribute tooltipAttribute = PropertyUtility.GetAttribute<TooltipAttribute>(property); EditorGUI.LabelField(labelRect, new GUIContent(property.displayName, tooltipAttribute != null ? tooltipAttribute.tooltip : ""));

Samhayne avatar Apr 03 '19 17:04 Samhayne

Tooltip still does not work with MinMaxSlider

JimmyCushnie avatar Apr 01 '20 03:04 JimmyCushnie

verifying this is still an issue with MinMaxSlider

smokelore avatar Nov 25 '20 00:11 smokelore

still reproducible

Befezdow avatar Feb 08 '21 22:02 Befezdow

I know it's still reproducible, but I don't know how to fix it. I am just implementing a CustomPropertyDrawer like everything else. It has to do something with the MinMaxSlider which Unity provides

dbrizov avatar Apr 24 '21 16:04 dbrizov

I noticed this with the MinValue and MaxValue as well.

https://stackoverflow.com/questions/58879682/cannot-add-a-tooltip-to-appear-when-the-mouse-hovers-to-a-unity-editorguilayout

Maybe this helps?

RWOverdijk avatar Feb 07 '22 13:02 RWOverdijk

I noticed this with the MinValue and MaxValue as well.

https://stackoverflow.com/questions/58879682/cannot-add-a-tooltip-to-appear-when-the-mouse-hovers-to-a-unity-editorguilayout

Maybe this helps?

This is exactly what is happening, some EditorGUILayout functions support tooltips, some don't. I won't be able to fix this bug unless I have Unity's source code.

dbrizov avatar Feb 07 '22 20:02 dbrizov

The other solution is to check manually if the properties have [Tooltip] attribute, and add the tooltip myself, but that means I have to make special cases all around the code, because I don't want to display 2 tooltips for the drawers that already support 1 tooltip. Actually, 2 tooltips can't happen, but 2 spaces because of the [Space] attribute can.

dbrizov avatar Feb 07 '22 20:02 dbrizov

Hi, the problem with the tooltip can be fixed with the code on the answer link. I have tried with my custom propertyDrawer, it works like a charm: If you update the codes it'll be fixed properly, link: http://answers.unity.com/answers/1544468/view.html

neohun avatar Apr 15 '22 02:04 neohun

@neohun thx! That set me on the right path. So, for me at least, I was able to fix this issue by removing the label parameter in EditorGUILayout.PropertyField calls. Not sure if this can interfere with some other NaughtyAttributes, but now my foldouts no longer disable tooltips.

CreepGin avatar Apr 23 '22 06:04 CreepGin

@neohun thx! That set me on the right path. So, for me at least, I was able to fix this issue by removing the label parameter in EditorGUILayout.PropertyField calls. Not sure if this can interfere with some other NaughtyAttributes, but now my foldouts no longer disable tooltips.

Glad to hear that, actually all problems caused by unity's terrible custom editor system but anyway (:

neohun avatar Apr 23 '22 21:04 neohun

Any update on this issue, it seems tooltips are still not working. For me it doesnt show tooltips with any property that I use NaughtyAttributes tags

ZnelArts avatar Jun 24 '22 23:06 ZnelArts

@ZnelArts Hi, It seems that unity has done some changes and this problem is fixed. If you upgrade your editor to an upper version it should work. I use unity 2019.4.39 and it works without any problem at least for now.. link: https://issuetracker.unity3d.com/issues/tooltips-are-not-shown-when-hovering-over-name-of-the-value-in-the-inspector

neohun avatar Jun 28 '22 19:06 neohun

I'm using 2020.3.25f1 but the issue still exists. I'm using Label and ShowIf for some fields but then the fields with Tooltip doesn't show the tooltips even that field doesn't use any NaughtyAttribute.

carsonwubc avatar Jul 24 '22 07:07 carsonwubc

Well, it works for my version of the editor I have no idea why it does not work for you maybe use another version and check again.

neohun avatar Jul 25 '22 16:07 neohun

Got it to work with a simple solution, I hope this is the same problem you're having.

In PropertyUtility.cs, in function GUIContent GetLabel(SerializedProperty property)

Line 36. Replace "GUIContent label = new GUIContent(labelText);"

with: GUIContent label = new GUIContent(labelText, property.tooltip);

Now my tooltips are visible, if the script uses NaughtyAttributes (at least min and max value ones). Weird that the problem persisted even for field that didn't use NaughtyAttributes - it was enough for any field to use NaughtyAttributes for all fields' tooltips to become disabled

maxsamarin avatar Oct 02 '22 21:10 maxsamarin