Unity3d 在StateMachineBehaviours的自定义统一检查器中显示脚本字段

Unity3d 在StateMachineBehaviours的自定义统一检查器中显示脚本字段,unity3d,customization,Unity3d,Customization,通常,我会在中使用以下方法在inspector中显示组件的脚本字段 private void DrawScriptField() { //禁用编辑 EditorGUI.BeginDisabledGroup(true); EditorGUILayout.ObjectField(“脚本”,MonoScript.frommonobhavior((MyClass)目标),typeof(MyClass),false); EditorGUI.EndDisabledGroup(); } 我的问题是MonoS

通常,我会在中使用以下方法在inspector中显示组件的脚本字段

private void DrawScriptField()
{
//禁用编辑
EditorGUI.BeginDisabledGroup(true);
EditorGUILayout.ObjectField(“脚本”,MonoScript.frommonobhavior((MyClass)目标),typeof(MyClass),false);
EditorGUI.EndDisabledGroup();
}
我的问题是
MonoScript
显然只包含两个方法
fromMonoBehavior
FromScriptableObject
,但是没有从
StateMachineBehaviour
获取脚本的方法


如何在自定义编辑器中为
StateMachineBehaviour
脚本创建类似的脚本字段?

哦,没关系。我读得太多了,实际上继承自
ScriptableObject
,因此我可以简单地使用
MonoScript.FromScriptableObject