Unity修改脚本后调试

修改脚本后调试有时候需要运行,为了提高效率可以设置编辑器中执行,同时也可以开启有效性检查(即更改面板变量即可刷新代码)

[ExecuteInEditMode]
public class XXXX: MonoBehaviour
{

    #if UNITY_EDITOR
    void OnValidate()
    {
        Refresh();
    }

    void Reset()
    {
        Refresh();
    }
    #endif

}
原文地址:https://www.cnblogs.com/llstart-new0201/p/10276586.html