我正在开发一个扩展unity3d编辑器的插件 . 此插件将作为托管dll附加到编辑器文件夹中的项目 . 插件的结构是这样的:

'Editor Folder'
'-- CustomPlugin.dll'
'    |-- CustomeEditor.cs -- main editor class which inherits EditorWindow'
'    -- AnchorNode.cs --a MonoBehaviour'

有类似这样的课程:

[ExecuteInEditMode]

public class AnchorNode :MonoBehaviour
{
    public GameObject next=null;
    public GameObject prev=null;
}

扩展EditorWindow类的插件类使用下面的MonoBehaviour,如下所示:

var nextAnchor = currentAnchor.GetComponent<AnchorNode>().next;

所以一切都好了我想把dll中的AnchorNode脚本附加到游戏中的游戏对象中 . 我不能和团结说:这是一个编辑器脚本 . 请注意我已将dll放在Project的Editor文件夹中,因为它是编辑器的插件,dll具有继承自MonoBehaviour的AnchorNode类,并且此MonoBehaviour应附加到场景中的游戏对象 .

我已经测试了这个方法,但我无法获得“next”属性,因为Component类没有名为“next”的属性:

var anchorNode =currentAnchor.GetComponent("AnchorNode");

那么如何在放置在编辑器文件夹中的dll中使用MonoBehaviour?

提前致谢...