private static bool Prefix(Transform parent, ActorInfo __instance, ref string ___model, ref Actor __result) { if (!modelToIds.ContainsKey(___model)) { return(true); } if (false && ___model == "Actor/Npc_Nora") { Dbgl("found Nora: " + ___model); string asset = "Cg/Cutscene_Marry_CG001"; SingleBundle bundle = AccessTools.FieldRefAccess <CutSceneMngr, SingleBundle>(Singleton <CutSceneMngr> .Instance, "bundle"); if (!bundle.Loaded) { bundle.Load("cg"); } UnityEngine.Object scene = bundle.LoadAsset <GameObject>(asset, false); if (scene == null) { Dbgl($"cannot find scene: {asset}"); } else { //GameObject go = GameObject.Instantiate(scene as GameObject); GameObject go = (scene as GameObject); Dbgl("found scene: " + asset); foreach (Transform t in go.GetComponentsInChildren <Transform>()) { break; if (t.gameObject != null && t.gameObject.name == "medium_NoraNew_Model") { UnityEngine.Object @object = Singleton <ResMgr> .Instance.LoadSyncByType(AssetType.Actor, ___model, false, false); GameObject gameObject = UnityEngine.Object.Instantiate(@object, parent) as GameObject; Actor actor = gameObject.GetComponent <Actor>(); GameObject gameObject2 = GameObject.Instantiate(t.gameObject, actor.gameObject.transform); SkinnedMeshRenderer smro = gameObject.GetComponentInChildren <SkinnedMeshRenderer>(); smro = SkinnedMeshRenderer.Instantiate(gameObject2.GetComponentInChildren <SkinnedMeshRenderer>(), smro.transform.parent); //AccessTools.FieldRefAccess<Actor, SkinnedMeshRenderer>(actor, "skinnedMeshRenderer") = ; __result = actor; return(false); //__result.RefreshMeshReference(smrs[0]); } } } } string id = modelToIds[___model]; bool enable = (bool)typeof(Settings).GetField($"EnableCustomModelFor{id}").GetValue(settings); if (!enable) { return(true); } string modelId = (string)typeof(Settings).GetField($"CustomModelFor{id}").GetValue(settings); string model = idToModels[modelId]; //Dbgl($"model: {model}"); ___model = model; return(true); }