Hello everybody,
I’m working on a solution for compiling an assembly which can be loaded and executed on run-time. The class library, which I created, cannot be loaded using System.Reflection.Assembly.Load(“ABC.dll”); . It throws a FileNotFoundException. The path is correct (the file is located inside the project folder), so the problem should be dealing with missing dependencies. Pasting that dll inside the Assets folder works, but I need it on run-time. The goal is that users are supposed to add custom AIs easily to the game.
This is how I created the dll: Injecting and Executing Code on runtime - Google Docs
The compiled assembly contains two MonoBehaviour classes which only log once during Start(). So far I’m trying to setup a functional prototype. Does anyone have an idea for troubleshooting this problem?
edit: Just solved it… Instead of using Assembly.Load() I have to use Assembly.LoadFrom().
That looks like an intuitive way to compile certain code in order to load it on a build on run-time. So different users can develope AI inside of Unity and distribute the dlls to other users.