OutOfRange error when picking up item.

SuperBoat

New member
Hi,
So I have followed the Ultimate Character Controller videos and set up a Nolan-based character, set up a sword and a pick up, then converted the character and sword with the Ultimate Inventory System wizard and the character picks up the sword pickup and equips it. However I get this error in the console after picking up the sword:
Code:
IndexOutOfRangeException: Index was outside the bounds of the array.
Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.ActiveAndNextItemSetData.Reset () (at Assets/Opsive/UltimateCharacterController/Integrations/UltimateInventorySystem/Scripts/ActiveAndNextItemSetData.cs:234)
Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.BridgeEquippableProcessing.UpdateItemSetItems (System.Boolean equip) (at Assets/Opsive/UltimateCharacterController/Integrations/UltimateInventorySystem/Scripts/BridgeEquippableProcessing.cs:468)
Opsive.UltimateCharacterController.Integrations.UltimateInventorySystem.BridgeEquippableProcessing.OnUnequipItemComplete (Opsive.UltimateCharacterController.Items.Item characterItem, System.Int32 slotID) (at Assets/Opsive/UltimateCharacterController/Integrations/UltimateInventorySystem/Scripts/BridgeEquippableProcessing.cs:422)
Opsive.Shared.Events.InvokableAction`2[T1,T2].Invoke (T1 arg1, T2 arg2) (at <27da9e1afec54f2fb2a11d46a234f9df>:0)
Opsive.Shared.Events.EventHandler.ExecuteEvent[T1,T2] (System.Object obj, System.String eventName, T1 arg1, T2 arg2) (at <27da9e1afec54f2fb2a11d46a234f9df>:0)
Opsive.UltimateCharacterController.Character.Abilities.Items.EquipUnequip.ItemUnequipComplete (System.Int32 slotID, System.Boolean canUpdate) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/EquipUnequip.cs:886)
Opsive.Shared.Game.SchedulerBase.AddEventInternal[T,U] (System.Single delay, Opsive.Shared.Game.ScheduledEventBase+InvokeLocation invokeLocation, System.Action`2[T1,T2] action, T value1, U value2) (at <30943c6321fb4a8cbbf1f4853f76af59>:0)
Opsive.Shared.Game.SchedulerBase.ScheduleFixed[T,U] (System.Single delay, System.Action`2[T1,T2] action, T value1, U value2) (at <30943c6321fb4a8cbbf1f4853f76af59>:0)
Opsive.UltimateCharacterController.Character.Abilities.Items.EquipUnequip.ItemUnequip (System.Int32 slotID, System.Boolean canUpdate) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/EquipUnequip.cs:825)
Opsive.UltimateCharacterController.Character.Abilities.Items.EquipUnequip.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/EquipUnequip.cs:659)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.UpdateAbilities (Opsive.UltimateCharacterController.Character.Abilities.Ability[] abilities) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:794)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.UpdateUltimateLocomotion () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:725)
Opsive.UltimateCharacterController.Character.CharacterLocomotion.Move (System.Single horizontalMovement, System.Single forwardMovement, System.Single deltaYawRotation) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/CharacterLocomotion.cs:477)
Opsive.UltimateCharacterController.Game.KinematicObjectManager+KinematicCharacter.Move (System.Boolean manualMove) (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:237)
Opsive.UltimateCharacterController.Game.KinematicObjectManager.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/KinematicObjectManager.cs:841)

Also, is there a way to show the items that are equipped in a hotbar just for equipped items?
 
The error has been fixed, you can download the latest integration version from our website.
It was a silly mistake where I used the slot count instead of the category count to loop over an array.

As for showing equipped items in a hotbar, there's nothing that does this automatically.
Item Hotbar are really game specific, they all work a bit differently. So we recommend that people create their custom Item Hotbar.
You can do so by inheriting the ItemHotbar class or if you want to make something even more custom you can inherit the ItemViewSlotContainerBase class.
In that custom script you can listen to the items being added/removed, equipped/unequip by listening to events and choose where they go in your hotbar, how they are used, etc...

You can start by reading those pages:

If you struggle with making that custom hotbar, feel free to make another post and I can point you in the right direction.
 
Top