Unity如何在鼠标悬停到某处的时候,显示相应的说明
目前主要是用于编辑器界面下,对于Inspector里的变量,可以这么写:
using UnityEngine;
public class Example : MonoBehaviour
{
[Tooltip("Health value between 0 and 100.")]
int health = 0;
}
在Inspector里面是这样的:

如果在UnityEditorWindow界面,如果要实现上述效果:
可以这么写:
GUILayout.BeginHorizontal();
string coment1 = "ssss";///定义一个string comment
float num = EditorGUILayout.FloatField(new GUIContent("float number", comment1), 5.0f);
GUILayout.EndHorizontal();
浙公网安备 33010602011771号