I am looking to build a Unity based app which can update itself when we feed it some c# code, like Unity does using editor scripts. An example below will update Unity front end:
#if UNITY_EDITOR
using UnityEngine;
using UnityEditor;
public class MyWindow : EditorWindow
{
string myString = "Hello World";
// Add menu named "My Window" to the Window menu
[MenuItem("Window/My Window")]
static void Init()
{
// Get existing open window or if none, make a new one:
MyWindow window = (MyWindow)EditorWindow.GetWindow(typeof(MyWindow));
window.Show();
}
void OnGUI()
{
GUILayout.Label("Base Settings", EditorStyles.boldLabel);
myString = EditorGUILayout.TextField("Text Field", myString);
}
}
#endif
It looks like Unity compiles editor script, converts into dll, then loads the dll and updates itself using reflection. But it's just a guess, which can be horribly wrong. Anyone has information from authentic source?