using HarmonyLib; using System; using UnityEngine; namespace CustomCosmeticLoader.Patches { [HarmonyPatch(typeof(MarbleHolder))] [HarmonyPatch("SetMarble")] internal class MarbleHolderSetMarblePatch { static void Postfix(MarbleHolder __instance, Cosmetic marbleObject) { if (!Config.enabled) return; if (marbleObject.Id != Config.skinToHijack && Config.skinToHijack != "*") return; MeshRenderer[] componentsInChildren = __instance.currentMarble.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { Material[] materials = componentsInChildren[i].materials; foreach (Material material in materials) material.mainTexture = Config.skins[Config.currentSkin]; } } } }