The problem is I need to get variables from an editor window to a script. Here’s my code for the editor:
class TestEditor extends EditorWindow {
var myValue : float = 2.0;
@MenuItem ("Window/Test Window")
static function Init () {
var window : TestEditor = EditorWindow.GetWindow(TestEditor);
}
function OnGUI () {
GUILayout.Label("Test Editor", EditorStyles.boldLabel);
myValue = EditorGUILayout.FloatField("Translate Z", myValue);
}
}
And for the script:
private var testEditor : TestEditor;
function Awake () {
testEditor = GetComponent(TestEditor);
}
function Update () {
transform.Translate(0, 0, testEditor.myValue * Time.deltaTime);
}
But I get an error:
And
Anyone?