jpw1991 / chebs-mercenaries

Cheb's Mercenaries adds mercenaries to Valheim that you can purchase with gold and upgrade with materials to fight (warriors, archers) or perform work (lumberjacks, miners).
The Unlicense
3 stars 3 forks source link

Certain mod configurations can apparently result in null object due to load order #53

Closed jpw1991 closed 5 months ago

jpw1991 commented 5 months ago

I haven't personally observed this, but apparently if load order loads mercenaries after necromancy then null object can occur.

[Info   :   BepInEx] Loading [ChebsMercenaries 2.4.0]
[Error  : Unity Log] The AssetBundle 'N:\_SteamLibraryN\steamapps\common\Ashlands Modded\BepInEx\plugins\ChebsMods\chebgonaz' can't be loaded because another AssetBundle with the same files is already loaded.
[Warning:ChebsMercenaries] Exception caught while loading assets: System.NullReferenceException: Object reference not set to an instance of an object
  at ChebsValheimLibrary.Base.LoadPrefabFromBundle (System.String prefabName, UnityEngine.AssetBundle bundle, System.Boolean radeonFriendly) [0x00000] in <89eaf17415d64cffa73428255271a66c>:0
  at ChebsMercenaries.BasePlugin+<>c__DisplayClass24_0.<LoadChebGonazAssetBundle>b__0 (ChebsMercenaries.Items.WeaponOfCommand w) [0x00016] in <ace6ff3c52de4bdaaed8be71ac466dc0>:0
  at System.Collections.Generic.List`1[T].ForEach (System.Action`1[T] action) [0x0001e] in <17d9ce77f27a4bd2afb5ba32c9bea976>:0
  at ChebsMercenaries.BasePlugin.LoadChebGonazAssetBundle () [0x00042] in <ace6ff3c52de4bdaaed8be71ac466dc0>:0
[Error  : Unity Log] NullReferenceException: Object reference not set to an instance of an object
Stack trace:
ChebsMercenaries.BasePlugin.LoadChebGonazAssetBundle () (at <ace6ff3c52de4bdaaed8be71ac466dc0>:0)
ChebsMercenaries.BasePlugin.Awake () (at <ace6ff3c52de4bdaaed8be71ac466dc0>:0)
UnityEngine.GameObject:AddComponent(Type)
BepInEx.Bootstrap.Chainloader:Start()
UnityEngine.GameObject:.cctor()
PlatformTools.Common.SingletonMonoBehaviour`1:get_Instance()
PlatformTools.PlatformManagerInitializer:OnRuntimeMethodLoad()
jpw1991 commented 5 months ago

One solution to this is to implement a soft dependency on Necromancy for Mercs

jpw1991 commented 5 months ago

ChebsNecromancy-4.10.3.zip

necromancy with a soft dependency on mercs for testing