Goal of this project was to implement runtime usage of ImGui in BepInEx plugin for games made in Unity Engine.
Also demonstrated example of using URP ScriptableRendererFeature
in runtime (heavy relies on System.Reflection
due to inaccessible official runtime API).
Here is instruction list in case if someone finds it useful, or for myself in case if I will return to the project in the future, or I will use it in other projects.
- Install BepInEx
- Run game once to create file structure required for using pluings
- Create empty project in Unity
- Install UImGui
- Create asset-bundle (named
mybundle
) with selected shaders and put into game folder (ImguiInstaller.cs#L30) - Build emtpy project and navigate to its path
- Copy all required
.dll
files to coresponding game folder- Managed:
UImGui.dll
ImGui.NET.dll
netstandard.dll
System.Runtime.CompilerServices.Unsafe.dll
- Plugins:
cimgui.dll
- all others
- Managed:
- Add attribute
[assembly: InternalsVisibleTo("<AssemblyName>")]
toUImGui.dll
to be able to use internal classes in runtime (replace<AssemblyName>
with your name) (for example use dnSpy), other possible option is to remove redurantinternal
keyword from package and skip this step - Create your own plugin and use ImGui functionality in runtime
- Congratulations š„³