【发布时间】:2020-07-24 16:08:27
【问题描述】:
【问题讨论】:
标签: c# unity3d game-engine unity3d-editor
【问题讨论】:
标签: c# unity3d game-engine unity3d-editor
这个答案不是我的,它来自link that I found on google。
你必须为你的类实现一个自定义检查器,当你想显示这样的警告时,你可以在
OnInspectorGUI中使用EditorGUILayout.HelpBox。类似的东西:
EditorGUILayout.HelpBox("Some warning text", MessageType.Warning);
EditorGUILayout.HelpBox 的MessageType 参数有多个选项,其中一个是Info,它似乎适合显示注释,而不是警告。
这里有一个second link,它提供了更多信息。
【讨论】:
也许Tooltipattribute 就足够了。它允许您记录您的公共字段,以便在鼠标悬停时显示工具提示弹出窗口。
s。 https://docs.unity3d.com/ScriptReference/TooltipAttribute.html 了解更多信息。
[更新]
我找到了一种开箱即用的更好方法(仍然不完美)。
Header attribute 允许您直接在检查器中显示文本,但无法包含富文本格式或图像
[Header("--- Note ---", order=1)]
[Space(-10, order = 2)]
[Header("First Attribute is between 1 and 10", order = 3)]
[Range(1, 10)]
public int FirstProperty = 1;
[Space(10, order = 4)]
public string Hint;
【讨论】: