Unity Plugin Manager (herein, UPM) is a tool for creating plugins and mods for games developed with the Unity engine.
UPM injects a static constructor into the GameObject class found within the UnityEngine namespace. This way, it is able to execute code before anything else in the game. Using this, it loads plugins from a folder named "Plugins" in the game's folder, and instantiates any MonoBehaviour derivatives with the [OnGameInit] attribute.
In order to build UPM or create plugins, you will need the .NET Core SDK and at least one of the following:
Within the UPM repository is a directory named Managed.UnityEngine
. This directory needs to contain specific files from one of the aforementioned prerequisites.
C:\Program Files\Unity [version]\Editor
)Data\Managed
and copy UnityEngine.dll
to the Managed.UnityEngine\Managed
directory in the UPM repositoryData\Managed\UnityEngine
and copy everything except UnityEngine.dll to the Managed.UnityEngine\Managed
directory in the UPM repositoryData\UnityExtensions\Unity\GUISystem\Standalone
and copy UnityEngine.UI.dll
to the Managed.UnityEngine\Managed
directory in the UPM repositoryManaged
directory (usually inside the game's Data
folder)UnityEngine
in its name to the Managed.UnityEngine\Managed
directory in the UPM repositoryYou should now be able to compile UPM by either using Build.All.bat
, PluginManager.sln
or manually calling dotnet build
in the appropriate directories.
After building UPM, you should have at least the following files:
PluginManager.Setup/bin/...
)PluginManager.Core/bin/...
)PluginManager.Setup/bin/...
)Any other files are not necessary for usage of UPM.
Place the aforementioned files into the directory where your target game is located, and run PluginManager.Setup.exe
(using Mono to do so, if not on Windows)
If UPM installed successfully, you should see a message stating UPM installed.
You are now free to create a Plugins
directory and place your plugins in there.
The creation of plugins is a relatively simple process.
Managed.Games
folder, if one does not existAssembly-CSharp.dll
, Assembly-UnityScript.dll
and/or Assembly-Boo.dll
files from your target game in that folder, if they are present in its Managed
folderPlugin.Projects
folderYou can compile your plugin by opening a command prompt in its folder and entering dotnet build
.
Refer to the sample plugin as an example of how to get started.