static void Postfix(MapSelectionMenuBehaviour __instance) { Debug.Log("Adding maps"); foreach (Mod mod in Main.mods) { foreach (Map a in mod.loadedMaps) { UnityEngine.Object.Instantiate <GameObject>(__instance.MapViewPrefab, Vector3.zero, Quaternion.identity, __instance.transform).GetComponent <MapViewBehaviour>().Map = a; } } }
internal static void LoadMaps() { Debug.Log("h"); MapSelectionMenuBehaviour menu = GameObject.FindObjectOfType <MapSelectionMenuBehaviour>(); foreach (Mod mod in mods) { foreach (Prefab prefab in mod.maps) { Debug.Log(prefab.asset); Map a = mod.Deserialize <Map>(prefab); if (a != null) { mod.loadedMaps.Add(a); UnityEngine.Object.Instantiate <GameObject>(menu.MapViewPrefab, Vector3.zero, Quaternion.identity, menu.transform).GetComponent <MapViewBehaviour>().Map = a; Debug.Log($"Map {a.name} was loaded for {mod.name}"); } else { Debug.Log($"Failed to load {prefab.asset} in {prefab.bundle} for {mod.name}"); } } } }