Creating a Unity Moddable game

Hi, what is the best approach to create a game where users can create mods ? I want the users to be able to create custom mods changing scenes and assets.

I thought about using a file based system but then I might loose all Unity benefits. Alternatively user could create scenes in unity export them as packages and then I could load those scenes at runtime, but I don't know if out of project scene loading is feasible.

On the game GUI the user can load a mod from a list of mods A script will load all the assets as follows (it is a rough idea) - import meshes - load the scene data - play

Thanks Fred

Unity uses .Net so users could compile their own Managed DLLs which you can load using WWW and JIT with System.Reflection.Assembly (

However, only classes in the bootstrap unity3d file can implement MonoBehaviours, so you'll have to create a plugin host interface for your modders, e.g.

interface IMod {
  void OnModWasLoaded(ModHost host);
  void OnUpdate();
  void OnModWillUnload();
  ... (game specific hooks) ...

class ModHost : MonoBehaviour {
  IMod userMod;

  void Start() {
  ... (etc, etc) ...

There's some caveats w/r/t how you get the DLL from your host unity game for moders to link against to get the interface (the internal DLLs are in $Project/Library/ScriptAssemblies/). Simply giving them IMod.cs won't fly because .Net won't consider them the "same" class (each assembly declares an implicit namespace).

If your modders have unity they can publish and load their own asset bundles. Alternatively, you'll have to implement your own content interface.

Hope that's enough to get you started ;)

If you want to give modders full control then you can make the Assembly-CSharp.dll and UnityEngine.dll from you most recent build available. Then anyone would be able to take control of the game. All you would have to do is provide an entry point and for the mods and a way to load .dll files at run time. For example you could make a mod interface as an entry point. Then when you load the .dll file you could check if a class implementing the interface exists and if so call its method. To do this however you will need to use System.Reflection and probably System.IO.