Hi everyone,
I’m using an editorscript to create scripts programmatically (in the editor, not a game). Now, I also am building up a level with this editor script and will need to add the newly created script to a gameobject. Is there any way to do this?
I am well aware that you can still addcomponent with a string by doing something like this:
System.Type t = System.Type.GetType(scriptName);
gameObj.AddComponent<t>();
But the script that I just generated is not in the list of types until I stop the editorscript and run it again. I’m guessing that the types get loaded on compile time, but is there a ways to “refresh” the System.Types during runtime, just like you can do an AssetDatabase.Refresh() at runtime?
Thanks!