Inventory Binding not working on iOS

fuelfoundrysix

New member
I get this error on XCode when equipping a sword on my IPhone 13 Pro. I created a fresh project with only UCC, UIS, and Integration. This error is happening in the Demo scene in the UIS integration. I am also using the latest version of everything.

If I remove the item object binding from the object then it works, but item binding is essential to our app because we have so many items
ExecutionEngineException: Attempting to call method 'Opsive.UltimateInventorySystem.Core.GenericAttributeBinding`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]::.ctor' for which no ahead of time (AOT) code was generated.
at System.Reflection.RuntimeConstructorInfo.InternalInvoke (System.Object obj, System.Object[] parameters, System.Boolean wrapExceptions) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.ItemObjectBinding.ConvertDataToAttributeBinding (Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.AttributeBindingData[] dataArray) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.ItemObjectBinding.InitializeInternal () [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Items.Actions.Bindings.StateObjectBindingGroup.Initialize (Opsive.Shared.StateSystem.StateObject boundStateObject, UnityEngine.GameObject boundGameObject) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Items.Actions.Impact.ImpactAction.Initialize (UnityEngine.GameObject character, Opsive.UltimateCharacterController.Items.Actions.CharacterItemAction characterItemAction) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Items.Actions.Impact.ImpactActionGroup.Initialize (Opsive.UltimateCharacterController.Items.Actions.Modules.ActionModule actionModule) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Items.Actions.Modules.ActionModule.Initialize (Opsive.UltimateCharacterController.Items.Actions.CharacterItemAction itemAction) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Items.Actions.Modules.ActionModuleGroup`1[T].OnModuleAdded (T module, UnityEngine.GameObject gameObject) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Items.Actions.Modules.ActionModuleGroup`1[T].Initialize (Opsive.UltimateCharacterController.Items.Actions.CharacterItemAction characterItemAction) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Items.Actions.CharacterItemAction.InitializeModuleGroups (System.Boolean force) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Items.Actions.CharacterItemAction.InitializeAction (System.Boolean force) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Items.CharacterItem.Initialize (System.Boolean force) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Inventory.InventoryBase.SpawnCharacterItem (Opsive.UltimateCharacterController.Items.CharacterItem characterItemPrefab, Opsive.Shared.Inventory.IItemIdentifier itemIdentifier) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Inventory.InventoryBase.SpawnItemIdentifiersCharacterItem (Opsive.Shared.Inventory.IItemIdentifier itemIdentifier, System.Int32 addToSlotID) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Inventory.InventoryBase.AddItemIdentifierAmount (Opsive.Shared.Inventory.IItemIdentifier itemIdentifier, System.Int32 amount, System.Boolean spawnCharacterItems, System.Int32 slotID) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Inventory.InventoryBase.PickupItem (Opsive.Shared.Inventory.IItemIdentifier itemIdentifier, System.Int32 amount, System.Int32 slotID, System.Boolean immediatePickup, System.Boolean forceEquip, System.Boolean notifyOnPickup, System.Boolean spawnCharacterItems) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Inventory.InventoryBase.AddItemIdentifierAmount (Opsive.Shared.Inventory.IItemIdentifier itemIdentifier, System.Int32 amount) [0x00000] in <00000000000000000000000000000000>:0
at System.Action`2[T1,T2].Invoke (T1 arg1, T2 arg2) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.Shared.Events.InvokableAction`2[T1,T2].Invoke (T1 arg1, T2 arg2) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.Shared.Events.EventHandler.ExecuteEvent[T1,T2] (System.Object obj, System.String eventName, T1 arg1, T2 arg2) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateInventorySystem.Core.InventoryCollections.ItemCollection.NotifyAdd (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, Opsive.UltimateInventorySystem.Core.DataStructures.ItemStack addedItemStack) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateInventorySystem.Core.InventoryCollections.ItemSlotCollection.SetItemAmount (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, System.Int32 slotIndex, System.Boolean removePreviousItem) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateInventorySystem.Core.InventoryCollections.ItemSlotCollection.AddItemInternal (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, System.Int32 slotIndex) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateInventorySystem.Core.InventoryCollections.ItemSlotCollection.AddItem (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, System.Int32 slotIndex) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.CharacterInventoryBridge.MoveItemToEquippable (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, System.Int32 equippableCollectionIndex, System.Int32 slotIndex) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.CharacterInventoryBridge.MoveEquip (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, System.Int32 equippableItemCollectionSet, System.Int32 slotID, System.Boolean equip) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.CharacterEquipUnequipItemAction.InvokeActionInternal (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, Opsive.UltimateInventorySystem.ItemActions.ItemUser itemUser) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateInventorySystem.ItemActions.ItemAction.InvokeAction (Opsive.UltimateInventorySystem.Core.DataStructures.ItemInfo itemInfo, Opsive.UltimateInventorySystem.ItemActions.ItemUser itemUser) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateInventorySystem.UI.Panels.ActionPanels.ItemActionPanel.InvokeActionInternal (System.Int32 index) [0x00000] in <00000000000000000000000000000000>:0
at Opsive.UltimateInventorySystem.UI.Panels.ActionPanels.ActionPanel`1[T].InvokeAction (System.Int32 index) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchPress (UnityEngine.EventSystems.PointerEventData pointerEvent, System.Boolean pressed, System.Boolean released) [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.EventSystems.StandaloneInputModule.ProcessTouchEvents () [0x00000] in <00000000000000000000000000000000>:0
at UnityEngine.EventSystems.StandaloneInputModule.Process () [0x00000] in <00000000000000000000000000000000>:0
 
Hi,
Your error seems to be AOT related. Some devices/compilers do not allow for generic types, so AOT code needs to be generated to define those types.

The UnitOptions window (Tools -> Opsive -> Unit Options) is tasked to generate a file when it changes.
Search for a file called "GeneratedStubs.cs", this file is auto generated by the UnitOptions window and sould contain the definition of all the Attributes that are used.
Try making a change in the UnitOptions window to force a refresh and try making another build.

If it continues to cause issues, please tell us the type of the attribute you are using and send us this "GeneratedStubs.cs" file.
 
Hi, I deleted the GeneratedStubs.cs, and refreshed the values in the UnitOptions window to default to regenerate the file. The same error still occurs.

I have attached the GeneratedStubs and a photo of the types of attributes being used. Again, this is built from a clean project using the newest versions of UCC, UIS, Integration, and ControlFreak.
 

Attachments

  • GeneratedStubs.cs
    4.3 KB · Views: 2
  • Screenshot 2023-01-25 at 8.47.43 AM.png
    Screenshot 2023-01-25 at 8.47.43 AM.png
    433.2 KB · Views: 6
  • Screenshot 2023-01-25 at 8.47.45 AM.png
    Screenshot 2023-01-25 at 8.47.45 AM.png
    431.6 KB · Views: 6
We'll take a look at this for the next update. It's likely that the integration demo scene is just missing an extra stub file to fill in the missing references. I know that it has worked on AOT platforms in the past so it's likely from one of the integration changes.
 
Hi Justin, thank you for the prompt reply. How long do you think the next update will take to release? We were planning to release a beta to our users and currently the AOT issue is our main roadblock. It took us 2 weeks to update from UCC V2 to V3, and we want to have a testable build for our users.

I have tried copying the values from the old GeneratedStubs file in V2 but the issue still persisted.
 
We are hoping to release the next update within a week or so once the PUN add-on is done. You can determine the object that is causing the problem by outputting the bindings within ItemObjectBinding and for any object that does not exist within the stubs file you'd add it manually in the same format as what is there now.
 
Using the default demo integration scene, every item in the inventory has this AOT issue. I've added all the types in the Unit Options window that I can find related to the SwordWeapon Variant, but it is still showing the same issue.
 
What type did you add manually in the generated sub?

Looking at your error message you've pasted above
ExecutionEngineException: Attempting to call method 'Opsive.UltimateInventorySystem.Core.GenericAttributeBinding`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]::.ctor' for which no ahead of time (AOT) code was generated.
it should be
new Opsive.UltimateInventorySystem.Core.GenericAttributeBinding<int>();

and if as you said it was all types within the demo it would also be
Code:
new Opsive.UltimateInventorySystem.Core.GenericAttributeBinding<int>();
new Opsive.UltimateInventorySystem.Core.GenericAttributeBinding<float>();
new Opsive.UltimateInventorySystem.Core.GenericAttributeBinding<AmmoData>();
(I might be missing some but I think those are it)
 
Top