class InsideEditorFolder {
public static void DoItToIt () {}
}
with this:
public class OutsideEditorFolder : MonoBehaviour {
[ContextMenu("Context Menu Item")] void ContextMenuItem () {
InsideEditorFolder.DoItToIt();
}
}
Here is a real-world example project (probably won't work right unless you have the Unity 3 beta). I assume this is an issue of namespaces, but I don't really know anything about that subject yet.
As of Unity3 you can actually do this. However, the editorscript will not be available when you publish to your target platform, so it is up to you to properly use #if UNITY_EDITOR #endif blocks to make sure that code only gets included when you run the game in the editor.
I'm pretty sure that in order for it to work, you need to make sure the editorscript is in an earlier "compilation phase" than the runtime script. Putting your editorscript in Plugins/Editor/MyEditorScript.cs should do the trick. that said, you can also do whatever you want to do in your editorscript in your runtime script. You can just access UnityEditor.* and do whatever you feel like, again with the same caveat that it will not work when you publish, so you need to use the ifdefs to make sure the code is not included in builds.
The scripts inside the "Editor" folder are supposed to be used only in the editor (like custom editors, custom windows, etc etc). Due to the compilation order (the editor folder scripts are compiled last), you can't access those scripts from outside the editor folder.
It might be possible that you could pass a delegate to the script outside the editor folder first, and then make that script call it when needed.
It might also be possible that you could just define the ContextMenu in the editor script, or that you could call: