CU_TextureRecover is a Unity Mono + BepInEx 5 runtime texture replacement framework. It replaces existing Texture2D pixel data in memory so UI components such as Image, RawImage, and Sprite can keep referencing the original texture object. It does not modify game asset files.
- Unity Mono game, not IL2CPP
- BepInEx 5.x already installed and working
- Visual Studio with .NET Framework 4.7.2 targeting pack
- Game-managed assemblies available from the target game
GuiReplacer.sln
GuiReplacer.csproj
Source/
Plugin.cs
TextureManager.cs
TextureLoader.cs
TextureReplacer.cs
HotReload.cs
Config.cs
Logger.cs
Overlay.cs
README.md
- Open
GuiReplacer.slnin Visual Studio. - Set the
GameRootMSBuild property to your game root folder, or keep the solution inside the game root. - If needed, set
GameNameso$(GameName)_Data/Managedpoints to the Unity managed assemblies. - Build the project as
Release | Any CPU. - Copy
GuiReplacer.dllto:
<GameRoot>/BepInEx/plugins/GuiReplacer.dll
The project references BepInEx and Unity assemblies from the target game instead of bundling them.
After installing the plugin DLL, start the game once. CU_TextureRecover automatically creates:
<GameRoot>/BepInEx/plugins/GuiReplacer/Config/CU_TextureRecover.cfg
<GameRoot>/BepInEx/plugins/GuiReplacer/GUI/
<GameRoot>/BepInEx/plugins/GuiReplacer/Cache/
Default configuration:
Enable = true
EnableHotReload = true
RecursiveScan = true
IgnoreCase = true
AllowSizeMismatch = false
EnableLog = true
ModsFolder = GuiReplacer/GUI
EnableOverlay = true
OverlayDuration = 3
OverlayFadeTime = 0.3
EnableDump = falsePut PNG files under:
<GameRoot>/BepInEx/plugins/GuiReplacer/GUI/
The PNG filename without extension is matched against Texture.name.
Examples:
GuiReplacer/GUI/button.png -> Texture.name == "button"
GuiReplacer/GUI/title.png -> Texture.name == "title"
GuiReplacer/GUI/icon/sword.png -> Texture.name == "sword"
GuiReplacer/GUI/enemy/boss.png -> Texture.name == "boss"
When IgnoreCase=true, filename matching is case-insensitive.
Press F8 in game to:
- Rebuild the live
Texture2Dlookup table. - Rescan
GuiReplacer/GUIfor PNG files. - Reapply all matching replacements.
This lets artists iterate on PNG files without restarting the game.
Set the following option in BepInEx/plugins/GuiReplacer/Config/CU_TextureRecover.cfg:
EnableDump = trueOn the next startup, CU_TextureRecover exports discovered textures to:
<GameRoot>/BepInEx/plugins/GuiReplacer/Cache/GUI_Dump/
Dumped filenames use Texture.name.png. If a file already exists, CU_TextureRecover appends the texture InstanceID. After the dump completes, EnableDump is automatically set back to false.
- CU_TextureRecover mutates existing texture pixel data and avoids replacing texture object references.
- Size mismatches are logged as
Texture Size Mismatch. - If
AllowSizeMismatch=false, mismatched PNG files are skipped. - If
AllowSizeMismatch=true, mismatched PNG files are scaled to the original texture dimensions before writing. - Some engine or platform textures may reject CPU-side writes. GuiReplacer tries
Graphics.CopyTexturefirst and falls back toSetPixels32when possible. - On startup, a non-interactive IMGUI overlay shows
TextureReplaceMod By Moonooonce whenEnableOverlay=true. - Pressing F8 after a successful hot reload shows
Reload Texture Successfor two seconds whenEnableOverlay=true. - The plugin scans on startup and only scans again when F8 is pressed; it does not scan every frame.
- No Harmony patching is used.