Sniper1_1-MaterialAssetRestorerCore icon

MaterialAssetRestorerCore

API that lets moon/interior devs use some of the vanilla materials that get broken during ripping game files into Unity.

Last updated a day ago
Total downloads 14198
Total rating 0 
Categories Tools
Dependency string Sniper1_1-MaterialAssetRestorerCore-1.0.1
Dependants 4 other packages depend on this package

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

MaterialAssetRestorerCore

Moon and interior devs are likely familiar with how poorly the certain assets rip when trying to design their levels. I made this tool to attempt to restore some at runtime. It can access materials both from within the vanilla prefabs and scenes. (My thread in the LC Modding Discord)

This mod works by searching through a moon after it is loaded to replace the broken ones from modded moons/interiors with the corresponding one from vanilla. API specs and example useage below.

NOTE: IN ORDER TO ACCESS VANILLA MATERIALS FROM SCENES, THEY ARE BRIEFLY LOADED DURING StartOfRound. FROM MY TESTING THIS DID NOT CAUSE MAJOR PERMANENT ISSUES, BUT A FEW ERRORS LIKE [Error : Unity Log] Cascade Shadow atlasing has failed, only one directional light can cast shadows at a time AND OTHER WARNINGS MAY BRIEFLY LOG. AGAIN, I DO NOT BELIEVE THIS CAUSES ANY MAJOR ISSUES LONG TERM.

API Docs For Devs

Create a json file (or multiple) with the format and in the direcotry shown below. Each json contains a list of MaterialSets. A MaterialSet is made up of a BaseMaterial, which is the name of the material in the vanilla game, and a ReplaceMaterial, which is the name of the material in your mod. Often these will likely be the same name, but they don't have to be. You must also specify either a PrefabName or a SceneName so that this tool knows where to look to find the BaseMaterial.

{
    "MaterialSets": [
        {
            "BaseMaterial" : "gamematerial",
            "ReplaceMaterial" : "yourmaterial",
            "PrefabName" : "gameprefab"
        },
        {
            "BaseMaterial" : "gamematerial",
            "ReplaceMaterial" : "yourmaterial",
            "SceneName" : "gamescene"
        }
    ]
}

Project Heirarchy (NOTE: YOU MUST PLACE THE JSON FILE IN THE plugins/MaterialReplacements/ FOLDER FOR THIS TO WORK):

YourMod/
├── plugins/
│   └── MaterialReplacements/
|       └── YourJSON.json
├── README.md
├── manifest.json
├── icon.png
├── CHANGELOG.md (optional)
└── LICENSE.md (optional)

Example Usecase

WaterAssetRestorer

Before

Without

After

with

Credits