Acces monobehaviour script from editor script


A bit new to editor scripts, i’m using a EditorWindow script made by the community to replace gameobjects in the scene with a prefab, but i’m trying to modify the script so that i can get and set some values of some of the scripts on these gameobjects. The first thing i noticed is that there is no way to access these monobehaviour scripts from the EditorWindow script, is there a way around that?

Update to Answer

Scripts under Plugins folder are in Assembly-CSharp-Editor-firstpass.

Change the script to Assets/Editor/

Assembly-CSharp-Editor-firstpass and Assembly-CSharp-firstpass are compiled first, so they cannot know
anything about other Assemblies classes

For accesing a class on a gameobject, you should have a reference to it in some variable. Or atleast have a reference to the gameobject you’re trying to get the class from.


Classname ourClass = (variable that holds gameobject).GetComponent();

then use the dot(.) operator to acces public fields and properties within that class.