Version: 2022.2

TooltipAttribute

class in UnityEngine

/

继承自:PropertyAttribute

切换到手册

描述

为 Inspector 窗口中的字段指定工具提示。

\ 工具提示悬停在所添加到的类上。

下面的脚本中添加了一个 health。它向用户提供有关 health 变量的值的范围信息。建议的范围在 TooltipAttribute 字符串中提供。

Note: Unity will only use Tooltips from Fields when displaying them in the Editor. You can add Tooltips to other areas, such as classes, structs, and properties to work with user created editor extensions, but Unity won't display them in the Editor.

using UnityEngine;

public class Example : MonoBehaviour { [Tooltip("Health value between 0 and 100.")] int health = 0; }

变量

tooltip工具提示文本。

构造函数

TooltipAttribute为字段指定工具提示。

继承的成员

变量

order可选字段,用于指定多个 DecorationDrawer 应采用的绘制顺序。