An in-game explorer and a suite of debugging tools for IL2CPP and Mono Unity games, to aid with modding development.
Releases
Mod Loader | IL2CPP | Mono |
---|---|---|
BepInEx 6.X | ✅ link | ❔* link |
BepInEx 5.X | ❌ n/a | ✅ link |
MelonLoader 0.3 | ✅ link | ✅ link |
Standalone | ✅ link | ✅ link |
* BepInEx 6.X Mono release may not work on all games yet.
Features
- Scene Explorer: Simple menu to traverse the Transform heirarchy of the scene.
- GameObject Inspector: Various helpful tools to see and manipulate the GameObject, similar to what you can do in the Editor.
- Reflection Inspector: Inspect Properties and Fields. Can also set primitive values and evaluate primitive methods.
- Search: Search for UnityEngine.Objects with various filters, or use the helpers for static Instances and Classes.
- C# Console: Interactive console for evaluating C# methods on the fly, with some basic helpers.
- Inspect-under-mouse: Hover over an object with a collider and inspect it by clicking on it. There's also a UI mode to inspect UI objects.
C# Console Tips
The C# Console can be used to define temporary classes and methods, or it can be used to evaluate an expression, but you cannot do both at the same time.
For example, you could run this code to define a temporary class (it will be visible within the console until you run Reset();
).
public class MyClass
{
public static void Method()
{
UnityExplorer.ExplorerCore.Log("hello");
}
}
You could then delete or comment out the class and run the following expression to run that method:
MyClass.Method();
However, you cannot define a class and run it both at the same time. You must either define class(es) and run that, or define an expression and run that.
You can also make use of the helper methods in the console to simplify some tasks, which you can see listed when the console has nothing entered for input. These methods are not accessible within any temporary classes you define, they can only be used in the expression context.
How to install
BepInEx
Note: For IL2CPP you should use BepInEx 6 (Bleeding Edge), for Mono you should use BepInEx 5 (until Mono support stabilizes in BepInEx 6).
- Install BepInEx for your game.
- Download the UnityExplorer release for BepInEx IL2CPP or Mono above.
- Take the
UnityExplorer.BIE.___.dll
file and put it in[GameFolder]\BepInEx\plugins\
- In IL2CPP, it is highly recommended to get the base Unity libs for the game's Unity version and put them in the
BepInEx\unity-libs\
folder.
MelonLoader
Note: You must use version 0.3 of MelonLoader or greater. Version 0.3 is currently in pre-release, so you must opt-in from your MelonLoader installer (enable alpha releases).
- Install MelonLoader for your game.
- Download the UnityExplorer release for MelonLoader IL2CPP or Mono above.
- Take the contents of the release and put it in the
[GameFolder]\Mods\
folder. It should look like[GameFolder]\Mods\UnityExplorer.ML.___.dll
Standalone
The standalone release is based on the BepInEx build, so it requires Harmony 2.0 (or HarmonyX) to function properly.
- Load the DLL from your mod or inject it. You must also make sure that the required libraries (Harmony, Unhollower for Il2Cpp, etc) are loaded.
- Create an instance of Unity Explorer with
ExplorerStandalone.CreateInstance();
- Optionally subscribe to the
ExplorerStandalone.OnLog
event to handle logging if you wish.
Logging
Explorer saves all logs to disk (only keeps the most recent 10 logs). They can be found in a "UnityExplorer" folder in the same place as where you put the DLL file.
These logs are also visible in the Debug Console part of the UI.
Settings
You can change the settings via the "Options" page of the main menu, or directly from the config file (generated after first launch). The config file will be found either inside a "UnityExplorer" folder in the same directory as where you put the DLL file, or for BepInEx it will be at BepInEx\config\UnityExplorer\
.
Main Menu Toggle
(KeyCode)
- Default:
F7
- See this article for a full list of all accepted KeyCodes.
Force Unlock Mouse
(bool)
- Default:
true
- Forces the cursor to be unlocked and visible while the UnityExplorer menu is open, and prevents anything else taking control.
Default Page Limit
(int)
- Default:
25
- Sets the default items per page when viewing lists or search results.
- Requires a restart to take effect, apart from Reflection Inspector tabs.
Default Output Path
(string)
- Default:
Mods\UnityExplorer
- Where output is generated to, by default (for Texture PNG saving, etc).
Log Unity Debug
(bool)
- Default:
false
- Listens for Unity
Debug.Log
messages and prints them to UnityExplorer's log.
Hide on Startup
(bool)
- Default:
false
- If true, UnityExplorer will be hidden when you start the game, you must open it via the keybind.
Building
If you'd like to build this yourself, all you need to do is download this repository and build from Visual Studio.
- Open the
src\UnityExplorer.sln
project. - Select
Solution 'UnityExplorer' (1 of 1 project)
in the Solution Explorer panel, and set the Active config property to the version you want to build, then build it. Alternatively, use "Batch Build" and select all releases. - The DLLs are built to the
Release\
folder in the root of the repository.
The references are all inside the lib\
folder, if you need to change them for some reason then you can replace them there.
Acknowledgments
- (GPL) ManlyMarco's Runtime Unity Editor, which I used for some aspects of the C# Console and Auto-Complete features. The snippets I used are indicated with a comment.
- (MIT) denikson (aka Horse)'s mcs-unity. I commented out the
SkipVisibilityExt
constructor since it was causing an exception with the Hook it attempted in IL2CPP. - (Apache) HerpDerpenstine for MelonCoroutines, which were included for standalone Il2CPP coroutine support.
- (Apache) InGameCodeEditor was used as the base for the syntax highlighting for UnityExplorer's C# console, although it has been heavily rewritten and optimized. Used classes are in the
UnityExplorer.UI.Main.CSConsole.Lexer
namespace.