KeyNotFoundException

frankstrayer

New member
I have only the first person shooter, followed the steps to adding an item to the character but i get this.

KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
Opsive.UltimateCharacterController.FirstPersonController.Character.FirstPersonObjects.CheckActiveBaseObjects () (at Assets/Opsive/UltimateCharacterController/FirstPersonController/Scripts/Character/FirstPersonObjects.cs:323)
Opsive.UltimateCharacterController.FirstPersonController.Character.FirstPersonObjects.StartEquip (Opsive.UltimateCharacterController.Items.Item item, System.Int32 slotID) (at Assets/Opsive/UltimateCharacterController/FirstPersonController/Scripts/Character/FirstPersonObjects.cs:295)
Opsive.UltimateCharacterController.FirstPersonController.Items.FirstPersonPerspectiveItem.StartEquip (System.Boolean immediateEquip) (at Assets/Opsive/UltimateCharacterController/FirstPersonController/Scripts/Items/FirstPersonPerspectiveItem.cs:763)
Opsive.UltimateCharacterController.Items.Item.StartEquip (System.Boolean immediateEquip) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Item.cs:363)
Opsive.UltimateCharacterController.Character.Abilities.Items.EquipUnequip.OnPickupItem (Opsive.UltimateCharacterController.Items.Item item, System.Single count, System.Boolean immediatePickup, System.Boolean forceEquip) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/EquipUnequip.cs:212)
Opsive.UltimateCharacterController.Events.InvokableAction`4[T1,T2,T3,T4].Invoke (T1 arg1, T2 arg2, T3 arg3, T4 arg4) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/InvokableAction.cs:225)
Opsive.UltimateCharacterController.Events.EventHandler.ExecuteEvent[T1,T2,T3,T4] (System.Object obj, System.String eventName, T1 arg1, T2 arg2, T3 arg3, T4 arg4) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/EventHandler.cs:497)
Opsive.UltimateCharacterController.Inventory.InventoryBase.AddItem (Opsive.UltimateCharacterController.Items.Item item, System.Boolean immediateEquip) (at Assets/Opsive/UltimateCharacterController/Scripts/Inventory/InventoryBase.cs:142)
Opsive.UltimateCharacterController.Items.Item.Start () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Item.cs:262)

and i have no idea how to fix it. im not good at C#. i dont have the vocabulary. im pretty much a full on noob.
 
I have added more error checking to that method so it'll now output an error rather than an exception. Make sure you've assigned the base object to the First Person Perspective Item component. This base object is assigned when initially creating the item under the First Person Base field. I would try going through the video one more time - if something doesn't match up exactly as it does in the video take a step back and see what is different between your scene and the video.
 
Top