您无法将 Unity 更新到最新的 4.6?我认为 Tooltip 是 Unity 4.5 的新功能。那么,解决方案呢?
http://answers.unity3d.com/questions/37177/additional-information-on-mouseover-in-the-inspect.html
资产/脚本/TooltipAttribute.cs:
using UnityEngine;
public class TooltipAttribute : PropertyAttribute
{
public readonly string text;
public TooltipAttribute(string text)
{
this.text = text;
}
}
资产/编辑器/TooltipDrawer.cs:
using UnityEditor;
using UnityEngine;
[CustomPropertyDrawer(typeof(TooltipAttribute))]
public class TooltipDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
{
var atr = (TooltipAttribute) attribute;
var content = new GUIContent(label.text, atr.text);
EditorGUI.PropertyField(position, prop, content);
}
}
现在您可以在 Unity 4.3 中使用 Tooltip。我猜。