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 (marbleObject.Id != "Swirl_M") return; // I only hijack this one skin, "Mirage" 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 = PatchEntryPoint.skin; } } } } }