Skip to content

Commit

Permalink
fix asset loading error
Browse files Browse the repository at this point in the history
  • Loading branch information
olavim committed Mar 1, 2023
1 parent f4189b1 commit 232f132
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions UnboundLib/Unbound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Unbound : BaseUnityPlugin
{
private const string ModId = "com.willis.rounds.unbound";
private const string ModName = "Rounds Unbound";
public const string Version = "3.2.7";
public const string Version = "3.2.8";

public static Unbound Instance { get; private set; }
public static readonly ConfigFile config = new ConfigFile(Path.Combine(Paths.ConfigPath, "UnboundLib.cfg"), true);
Expand Down Expand Up @@ -163,20 +163,6 @@ IEnumerator ArmsRaceStartCoroutine(On.GM_ArmsRace.orig_Start orig, GM_ArmsRace s
// hook for closing ongoing lobbies
GameModeManager.AddHook(GameModeHooks.HookGameStart, CloseLobby);

// Load toggleUI asset bundle
toggleUI = AssetUtils.LoadAssetBundleFromResources("togglemenuui", typeof(ToggleLevelMenuHandler).Assembly);

// Load toggleUI asset bundle
linkAssets = AssetUtils.LoadAssetBundleFromResources("unboundlinks", typeof(Unbound).Assembly);

// Add managers
gameObject.AddComponent<LevelManager>();
gameObject.AddComponent<CardManager>();

// Add menu handlers
gameObject.AddComponent<ToggleLevelMenuHandler>();
gameObject.AddComponent<ToggleCardsMenuHandler>();

On.CardChoice.Start += (orig, self) =>
{
for (int i = 0; i < self.cards.Length; i++)
Expand Down Expand Up @@ -242,6 +228,14 @@ private void Awake()
var harmony = new Harmony(ModId);
harmony.PatchAll();

// Add managers
gameObject.AddComponent<LevelManager>();
gameObject.AddComponent<CardManager>();

// Add menu handlers
gameObject.AddComponent<ToggleLevelMenuHandler>();
gameObject.AddComponent<ToggleCardsMenuHandler>();

LoadAssets();
GameModeManager.Init();

Expand Down Expand Up @@ -365,7 +359,10 @@ private void OnGUI()

private static void LoadAssets()
{
toggleUI = AssetUtils.LoadAssetBundleFromResources("togglemenuui", typeof(ToggleLevelMenuHandler).Assembly);
linkAssets = AssetUtils.LoadAssetBundleFromResources("unboundlinks", typeof(Unbound).Assembly);
UIAssets = AssetUtils.LoadAssetBundleFromResources("unboundui", typeof(Unbound).Assembly);

if (UIAssets != null)
{
modalPrefab = UIAssets.LoadAsset<GameObject>("Modal");
Expand Down

0 comments on commit 232f132

Please sign in to comment.