- Home /
Plugin To Extend Editor By DLL which contains Mono behaviours
I am developing a plugin which extends unity3d editor. this plugin will append as a managed dll to the project in editor folder. structure of plugin is something like this:
'Editor Folder'
'-- CustomPlugin.dll'
' |-- CustomeEditor.cs -- main editor class which inherits EditorWindow'
' -- AnchorNode.cs --a MonoBehaviour'
There is a class something like this :
[ExecuteInEditMode]
public class AnchorNode :MonoBehaviour
{
public GameObject next=null;
public GameObject prev=null;
}
The plugin class which extends EditorWindow class use MonoBehaviour below like this:
var nextAnchor = currentAnchor.GetComponent<AnchorNode>().next;
So everything go ok unitl I want to attach AnchorNode script in dll to game objects in game . I can't and unity says : this is an editor script. Please note I have placed dll in Project's Editor folder because it is a plugin for editor and dll has AnchorNode class which inherits from MonoBehaviour and this MonoBehaviour should be attached to game objects within scene.
I have tested this method but I can't get "next" attribute, because Component class has no attribute named "next" :
var anchorNode =currentAnchor.GetComponent("AnchorNode");
So How Can I use MonoBehaviour in a dll which is placed in editor folder?
Thanks in advance...
Your answer
Follow this Question
Related Questions
Execute editor window scripts when project errors are present 0 Answers
How can I add a button next to the play button in the editor? 1 Answer
Cant link PLUGIN.DLL with PLUGIN-EDITOR.DLL 1 Answer
Unity editor extension - create drag and drop (similar to Buildbox) 1 Answer
How can I use a plugin DLL in Editor (for tooling) but exclude it from my build? 1 Answer