Create a C# class at runtime in Unity

Hello,

I was wondering how could I create a C# class during runtime either from a Xml or a String or any other method.

I am aware of some of the risks, and I am aware of the posibillity to include the class properties in a dictionary of a predefined class.
The Dictionary aproach is not what I am looking for.

I am literally looking for a C# class generated dynamically at runtime.

Thank you.

http://olondono.blogspot.dk/2008/02/creating-code-at-runtime.html

But it can get extremely ugly with bugs!

Thank you. I will check it out and try it.

I assume I can apply the example in Unity ?

Will it work if I deploy to iOS and Android ?

Definitely not iOS; it’d be a breach of Apple’s developer agreement.

Reflection doesn’t really work on iOS because of the AOT compilation.

–Eric

Thank you all for a prompt reply.