public void EditFormulaField(Formula f, int i) { string name = "formulae.formula." + i; bool priorWrap = EditorStyles.textField.wordWrap; EditorStyles.textField.wordWrap = true; GUI.SetNextControlName("" + fdb.GetInstanceID() + "." + i); EditorGUI.BeginChangeCheck(); f.text = EditorGUILayout.TextArea(f.text, GUILayout.Height(32), GUILayout.Width(Screen.width - 24)).RemoveControlCharacters(); if (EditorGUI.EndChangeCheck() || (GUI.GetNameOfFocusedControl() != name && lastFocusedControl == name)) { // Debug.Log("compile "+f.text); FormulaCompiler.CompileInPlace(f); } GUI.SetNextControlName(""); EditorStyles.textField.wordWrap = priorWrap; if (f.compilationError != null && f.compilationError.Length > 0) { EditorGUILayout.HelpBox(f.compilationError, MessageType.Error); } }