https://docs.unity3d.com/ScriptReference/HelpURLAttribute.html
给字段添加提示
--------------------------------------------------------------------------------------------
给类添加帮助文档url
--------------------------------------------------------------------------------------------
添加个Header
--------------------------------------------------------------------------------------------
给字段加右键菜单
--------------------------------------------------------------------------------------------
添加上下文菜单
--------------------------------------------------------------------------------------------
禁止添加多个同名组件到同一个GameObject上
--------------------------------------------------------------------------------------------
游戏启动时自动调用添加了此特性的方法
给字段重命名,避免修改变量名后序列化数据丢失
[HideInInspector] public float hideVar; //使public变量不在Inspector面板中显示
-------------------------------------------------------------------------------------------------
允许脚本在编辑环境下执行,并自动添加必要组件
---------------------------------------------------------------------------------------------------
游戏运行时自动执行方法
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RuntimeInitializeOnLoadMethodTest
{
// 场景载入后游戏开始运行时触发
[RuntimeInitializeOnLoadMethod]
static void OnRuntimeMethodLoad()
{
Debug.Log("OnRuntimeMethodLoad");
}
// 场景载入后游戏开始运行时触发
[RuntimeInitializeOnLoadMethod]
static void OnSecondRuntimeMethodLoad()
{
Debug.Log("OnSecondRuntimeMethodLoad");
}
}
----------------------------------------------------------------------------------------------------
[ExecuteInEditMode] //当Editor不运行时Test脚本也能执行
public class Test : MonoBehaviour { }
给脚本加帮助文档URL
using UnityEngine;
[CreateAssetMenu(menuName="测试资源文件", fileName="NewBehaviourScript", order=0)]
public class NewBehaviourScript : ScriptableObject
{
}