Maybe Im missing something here, but Im having problems regarding tooltips:
I have a class with several properties, which each have a [Tooltip(“”)] attribute assigned to them. However, when I get the SerializedProperty’s .tooltip member, it is empty. Is this a bug or am I doing something wrong? Running Unity 4.6.1f1 here
Also, for people who are wondering why Im not just using PropertyField, the labels are eating away too much space for my desire, so I am overwriting it this way. If there is another better way please let me know.
using System;
using UnityEngine;
[Serializable]
public struct Test
{
[SerializeField]
private int intValue;
}
MonoBehaviour with field of the Test type:
using UnityEngine;
public class Tooltips : MonoBehaviour
{
[Tooltip("I'm invisible tooltip :(")]
public Test test;
[Tooltip("I'm visible tooltip :)")]
public Vector3 vector;
}
The drawer itself:
using UnityEngine;
using UnityEditor;
[CustomPropertyDrawer(typeof(Test))]
public class TestDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
SerializedProperty intValue = property.FindPropertyRelative("intValue");
EditorGUI.PropertyField(position, intValue, label);
}
}
Both property.tooltip and label.tooltip are empty for me.
I fixed it the other day We had a bug report about our Localization property drawers not displaying tooltips, after investigation I discovered it was an issue for all PropertyDrawers. The fix was actually really simple, the tooltip data is in the Property handler code, we just didn’t pass it through. The original bug was closed as low priority in 2017.
Moral of the story, keep making bug reports, it brings the old issues back into light so we can revaluate them.
Thank you Karl! While you’re at the tooltip, could you please remove the restriction from the TooltipAttribute that it can be used on fields only? This should be a trivial change without any risk I assume.
I would like to use the built-in TooltipAttribute to display them as “class comments”, see here .
Thanks Karl! Would be great if “low priority” wasnt a valid reason for closing an issue. Could that be reviewed? Takes time and dedication to open an issue, is a pitty to have them closed merely for bureaucratic reasons.
Karl, do you now what releases are expected to include your fix? My current project is still using Unity 2018.4.30. Is your fix expected to be included in 2018 LTS?
Is this fixed in 2020.3 as well? I assumed as much because it’s fixed for 2020.2.X but my Custom Inspector still get’s empty strings for properties that have a tooltip