accessing a runtime script in an editor script

I store a number of game options in a static class. The user can modify these options at runtime, but I’d also like to be able to set them in the editor.

So I wrote a simple editor script, but I can’t access the runtime script, I get a compile error (unknown type). I suppose the editor and runtime scripts are on different namespaces or something like that…

Any idea?

I don’t know what the answer is, but a work-around would be to create a runtime script with a setup function and have it be a ContextMenu. Something like this:

static var someValue : int = 0;
var newValue : int = 0;

@ContextMenu("Set value")

function SetValue() {
	someValue = newValue;
}

What would this script be, editor or runtime?
If it’s a runtime script, I don’t think it can declare a context menu.
And if it’s and editor script, then a runtime script wouldn’t be able to access the static var someValue, which was the point to start with.

So… either I didn’t get what you where saying, or it won’t work.

Thanks anyway :wink: … I feel very lonely with my problem :cry:

Move your runtime script to one of the folders that gets compiled in a previous phase than Editor:

http://unity3d.com/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html

Cheers,
-Jon