Possible to modify/rewrite a scrpt during run-time

Is it possible to modify a script during run time, for instance, declare a new variable or rewrite a function. Basically self modifying code

If so could you point me in the right direction,

Several things. Probably the only way to do this is to use Reflection, and so right away iOS is out.

Here is Unity’s stance on loading a script from an asset bundle (they basically say no): http://docs.unity3d.com/Manual/scriptsinassetbundles.html

But, here’s a thread showing some promise with doing what you want: MonoBehaviour from DLL in AssetBundle Reflection problem - Unity Answers

Also, if you search, there are many others.

EDIT: I should point out that my point in being able to load code from a downloaded asset bundle is that if you can do it that way, you should also be able to create your code at runtime or load it from a file, etc. Sorry, I didn’t make that clear in the first post. :slight_smile: