Hello,
I am hoping to get some advice on how I can solve a problem I am having with how to load code dynamically into a unity game. To clarify the problem, let me explain an example scenario:
You are playing a game using a client made in Unity. Your character does not do anything because it is your job to make it do something. If code is created outside of the Unity game, how can it be loaded into the game to be used to interact with the “character”.
I am looking for technical details on how I can load this code into a game made with Unity dynamically. I would prefer if the code being imported was written in Javascript or C# and I could use that somehow. I don’t know if the answer has something to do with maybe compiling C# code instead and loading an assembly dynamically.
If any of this is unclear, please respond and I will try my best to clarify.
Thanks for any help,
John
You might be interested in this thread: http://forum.unity3d.com/threads/102162-Mono-CSharp-Evaluator
– whydoidoitThanks for responding! Does this mean I am stuck using C#? Unfortunately for me, this does not seem like a very elegant solution to make programming a game at runtime possibly, which is ultimately what I am saying to do here. Would it be possible to server side the build process with something like the Mono.CSharp DLL so that code could be "submitted" to it, compiled to an assembly and that assembly spit back or even loaded into the game server?
– tharealjohnYes it's possible to create an assembly server side and then run it on the client (on appropriate platforms).
– whydoidoitYou might want to consider something like LUA: http://forum.unity3d.com/threads/167719-UniLua-A-pure-C-implementation-of-Lua-5-2-focus-on-compatibility-with-Unity3D
– whydoidoitThank you for your help and suggestions again. I will consider the LUA approach.
– tharealjohn