UIS not working in Standalone build (Standard windows build x86_64) but works in editor play mode

Sekto007

New member
Hello,

My Ultimate Inventory System is broken when doing a standalone build (using latest version of UIS). After building it again in Development mode with full log output, this is what I saw.

Screenshot 2021-03-09 212646.jpg

In addition to the above image, here is a snippet from the player.log - can someone please help me out with this one? I'm really stumped because everything works just fine in the editor when running the game. Thanks


Code:
Error: A category must exist for each slot in the item slot set MyInventoryDatabaseEquippedSlots. The slot at index 0 is missing the category for the Item Collection Equipped.
0x00007ffb6ac8f7fc (UnityPlayer)
0x00007ffb6ac94f09 (UnityPlayer)
0x00007ffb6ac76a48 (UnityPlayer)
0x00007ffb6c0f3374 (UnityPlayer) UnityMain
0x00007ffb6b7d7c2e (UnityPlayer) UnityMain
0x00007ffb68bbd6d3 (GameAssembly) [UnityEngine.CoreModule.cpp:44540] Logger_Log_mD84CAE986DDEB614141DEDBDD023F7EB2EA511E7
0x00007ffb68bb13d1 (GameAssembly) [UnityEngine.CoreModule.cpp:32892] Debug_LogError_mEFF048E5541EE45362C0AAD829E3FA4C2CAB9199
0x00007ffb68f80014 (GameAssembly) [Opsive.UltimateInventorySystem5.cpp:17444] ItemSlotCollection_Initialize_m9CB8029EA5C96C1E0D444155D9DFD5527422F4C8
0x00007ffb68dc0307 (GameAssembly) [Opsive.UltimateInventorySystem2.cpp:30330] Inventory_Deserialize_mB655AA727F43DD99A4573858E569DF40B446F23A
0x00007ffb68dc1df8 (GameAssembly) [Opsive.UltimateInventorySystem2.cpp:29978] Inventory_Initialize_m4A647CDEF154634367304F09FC673212C696A4F2
0x00007ffb67e1adfc (GameAssembly) [Il2CppInvokerTable.cpp:150310] RuntimeInvoker_TrueVoid_t700C6383A2A510C2CF4DD86DABD5CA9FF70ADAC5
0x00007ffb67dc14c0 (GameAssembly) [Runtime.cpp:568] il2cpp::vm::Runtime::Invoke
0x00007ffb6b67b398 (UnityPlayer) UnityMain
0x00007ffb6b693aac (UnityPlayer) UnityMain
0x00007ffb6b693bdf (UnityPlayer) UnityMain
0x00007ffb6b6cd455 (UnityPlayer) UnityMain
0x00007ffb6b69e428 (UnityPlayer) UnityMain
0x00007ffb6b69df1d (UnityPlayer) UnityMain
0x00007ffb6b69e2af (UnityPlayer) UnityMain
0x00007ffb6b6f526e (UnityPlayer) UnityMain
0x00007ffb6b6f5631 (UnityPlayer) UnityMain
0x00007ffb6b2acab4 (UnityPlayer) UnityMain
0x00007ffb6b2aeeb4 (UnityPlayer) UnityMain
0x00007ffb6b2ad49c (UnityPlayer) UnityMain
0x00007ffb6b2b0134 (UnityPlayer) UnityMain
0x00007ffb6b2b0440 (UnityPlayer) UnityMain
0x00007ffb6acc069e (UnityPlayer)
0x00007ffb6acbe67d (UnityPlayer)
0x00007ffb6acc3f0b (UnityPlayer)
0x00007ffb6acc4e5b (UnityPlayer) UnityMain
0x00007ff748c811f2 (Project Vulcan)
0x00007ffc4eeb7034 (KERNEL32) BaseThreadInitThunk
0x00007ffc4fea2651 (ntdll) RtlUserThreadStart
 
... That's weird. There's not enough detail in the errors to know what is going on. It seems the Item Categories aren't registered but it's not clear why.

Would you mind trying using "Mono" as the scripting backend instead of IL2CPP. That may solve the errors. I will dig into it to see if I can replicate the bug.
1615362991735.png
 
Using Mono is not an acceptable alternative for me, and I also use the latest version of .NET - not 2.0....

If this is the only option I have than I will have to stop using the Ultimate Inventory System. Just so you are aware this wasn't an issue until I updated to the latest version of Ultimate Inventory System but at this point there would be no going back to a previous version.
 
So I made multiple builds of the demo scene with different parameters and they all worked fine, including IL2CPP with .Net 4.x.

This means there might be something wrong with your project or your scene. Could you try building the demo scene to see if it works? This might give us an idea of whether your project or your scenes are the cause of the problem.
 
Well, I found out what the issue was... I hadn't made a build in a little while; since my last standalone build I had completed your video tutorial on adding the rarity item attribute. I follow along with your video's in my own project. Everything worked fine after following your video when playing the game in the editor, but it looks like something about that specific attribute broke my game in standalone build.

After seeing the error message in my player.log below and then deleting the item rarity attribute from my "All" item base category - the game worked just fine in standalone and all the errors disappeared.


Code:
UnloadTime: 3.149600 ms
ExecutionEngineException: Attempting to call method 'Opsive.UltimateInventorySystem.Core.AttributeSystem.Attribute`1[[ITEM_RARITY, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]::.ctor' for which no ahead of time (AOT) code was generated.
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <00000000000000000000000000000000>:0
  at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.Shared.Utility.Serialization.DeserializeFields (Opsive.Shared.Utility.MemberVisibility visibility, System.Func`3[T1,T2,TResult] onValidateCallback) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.UltimateInventorySystem.Core.AttributeSystem.AttributeCollection.Deserialize (System.Boolean force) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.UltimateInventorySystem.Core.AttributeSystem.AttributeCollection.Initialize (System.Boolean force) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.UltimateInventorySystem.Core.ObjectCategoryBase`2[Tc,Te].Initialize (System.Boolean force) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.UltimateInventorySystem.Core.ItemCategory.Initialize (System.Boolean force) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.UltimateInventorySystem.Core.InventorySystemManager.AddDatabase (Opsive.UltimateInventorySystem.Storage.IInventorySystemDatabase database) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.UltimateInventorySystem.Core.InventorySystemManager.Initialize () [0x00000] in <00000000000000000000000000000000>:0
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) [0x00000] in <00000000000000000000000000000000>:0
  at System.Activator.CreateInstance (System.Type type, System.Boolean nonPublic) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.Shared.Utility.Serialization.DeserializeFields (Opsive.Shared.Utility.MemberVisibility visibility, System.Func`3[T1,T2,TResult] onValidateCallback) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.UltimateInventorySystem.Core.AttributeSystem.AttributeCollection.Deserialize (System.Boolean force) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.UltimateInventorySystem.Core.AttributeSystem.AttributeCollection.Initialize (System.Boolean force) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.UltimateInventorySystem.Core.ObjectCategoryBase`2[Tc,Te].Initialize (System.Boolean force) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.UltimateInventorySystem.Core.ItemCategory.Initialize (System.Boolean force) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.UltimateInventorySystem.Core.InventorySystemManager.AddDatabase (Opsive.UltimateInventorySystem.Storage.IInventorySystemDatabase database) [0x00000] in <00000000000000000000000000000000>:0
  at Opsive.UltimateInventorySystem.Core.InventorySystemManager.Initialize () [0x00000] in <00000000000000000000000000000000>:0
 
In that case the error must have been an issue with the auto generated AOT code. Normally when you add a custom Attribute Type it should automatically generate the AOT code for building IL2CPP builds. If this problem comes up again let us know how you replicated the error such that we can try to find a solution.
 
Top