Curious Case of Questionable Keys

Aipocalypse

New member
Ultimate Character Controller
Unity 2018.2.13.f1

I'm not sure if this actually constitutes as a 'bug' or if I simply missed something that I'm failing to find.
I've been following along with the Opsive video's for the UCC, and going through sections of the documentation for setting up weapon type items.

If I have an 'Item' of any type existing on the character I'm getting
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[Opsive.UltimateCharacterController.Items.Item,UnityEngine.GameObject[]].get_Item (Opsive.UltimateCharacterController.Items.Item key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
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, Int32 slotID) (at Assets/Opsive/UltimateCharacterController/FirstPersonController/Scripts/Character/FirstPersonObjects.cs:295)
Opsive.UltimateCharacterController.FirstPersonController.Items.FirstPersonPerspectiveItem.StartEquip (Boolean immediateEquip) (at Assets/Opsive/UltimateCharacterController/FirstPersonController/Scripts/Items/FirstPersonPerspectiveItem.cs:763)
Opsive.UltimateCharacterController.Items.Item.StartEquip (Boolean immediateEquip) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Item.cs:363)
Opsive.UltimateCharacterController.Character.Abilities.Items.EquipUnequip.OnPickupItem (Opsive.UltimateCharacterController.Items.Item item, Single count, Boolean immediatePickup, Boolean forceEquip) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/EquipUnequip.cs:212)
Opsive.UltimateCharacterController.Events.InvokableAction`4[Opsive.UltimateCharacterController.Items.Item,System.Single,System.Boolean,System.Boolean].Invoke (Opsive.UltimateCharacterController.Items.Item arg1, Single arg2, Boolean arg3, Boolean arg4) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/InvokableAction.cs:225)
Opsive.UltimateCharacterController.Events.EventHandler.ExecuteEvent[Item,Single,Boolean,Boolean] (System.Object obj, System.String eventName, Opsive.UltimateCharacterController.Items.Item arg1, Single arg2, Boolean arg3, Boolean arg4) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/EventHandler.cs:497)
Opsive.UltimateCharacterController.Inventory.InventoryBase.AddItem (Opsive.UltimateCharacterController.Items.Item item, 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)

Following through further with the same setup in the Melee Weapon Setup video at the point of adding another to the 'Animator Audio' which seemed to fix the problem of only being able to swing once in the video just gives me another error every time I try to attack after the first
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[Opsive.UltimateCharacterController.Items.Item,UnityEngine.GameObject[]].get_Item (Opsive.UltimateCharacterController.Items.Item key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
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, Int32 slotID) (at Assets/Opsive/UltimateCharacterController/FirstPersonController/Scripts/Character/FirstPersonObjects.cs:295)
Opsive.UltimateCharacterController.FirstPersonController.Items.FirstPersonPerspectiveItem.StartEquip (Boolean immediateEquip) (at Assets/Opsive/UltimateCharacterController/FirstPersonController/Scripts/Items/FirstPersonPerspectiveItem.cs:763)
Opsive.UltimateCharacterController.Items.Item.StartEquip (Boolean immediateEquip) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Item.cs:363)
Opsive.UltimateCharacterController.Character.Abilities.Items.EquipUnequip.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/EquipUnequip.cs:544)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.UpdateAbilities (Opsive.UltimateCharacterController.Character.Abilities.Ability[] abilities) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:622)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.UpdateUltimateLocomotion () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:549)
Opsive.UltimateCharacterController.Character.CharacterLocomotion.Move (Single horizontalMovement, Single forwardMovement, Single deltaYawRotation) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/CharacterLocomotion.cs:455)
Opsive.UltimateCharacterController.Game.DeterministicObjectManager+DeterministicCharacter.FixedMove () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/DeterministicObjectManager.cs:146)
Opsive.UltimateCharacterController.Game.DeterministicObjectManager.FixedUpdate () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/DeterministicObjectManager.cs:589)
Much the same just with some different locations involved.

Thank you for your time, and all of your hard work on the assets.
 
Do you have multiple arm GameObjects under the First Person Objects GameObjects? It looks like multiple references are pointing to the same arm. For this I would start with a fresh character so you dont have duplicate objects.
 
I wasn't working with actual separate arms in the previous example, so I went and created a fresh setup, using Nolan instead of a different model to see if I had something with the other model set up wrong.
Clean project, roughly the same error code
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[Opsive.UltimateCharacterController.Items.Item,UnityEngine.GameObject[]].get_Item (Opsive.UltimateCharacterController.Items.Item key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
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, Int32 slotID) (at Assets/Opsive/UltimateCharacterController/FirstPersonController/Scripts/Character/FirstPersonObjects.cs:295)
Opsive.UltimateCharacterController.FirstPersonController.Items.FirstPersonPerspectiveItem.StartEquip (Boolean immediateEquip) (at Assets/Opsive/UltimateCharacterController/FirstPersonController/Scripts/Items/FirstPersonPerspectiveItem.cs:763)
Opsive.UltimateCharacterController.Items.Item.StartEquip (Boolean immediateEquip) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Item.cs:363)
Opsive.UltimateCharacterController.Character.Abilities.Items.EquipUnequip.OnPickupItem (Opsive.UltimateCharacterController.Items.Item item, Single count, Boolean immediatePickup, Boolean forceEquip) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/EquipUnequip.cs:212)
Opsive.UltimateCharacterController.Events.InvokableAction`4[Opsive.UltimateCharacterController.Items.Item,System.Single,System.Boolean,System.Boolean].Invoke (Opsive.UltimateCharacterController.Items.Item arg1, Single arg2, Boolean arg3, Boolean arg4) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/InvokableAction.cs:225)
Opsive.UltimateCharacterController.Events.EventHandler.ExecuteEvent[Item,Single,Boolean,Boolean] (System.Object obj, System.String eventName, Opsive.UltimateCharacterController.Items.Item arg1, Single arg2, Boolean arg3, Boolean arg4) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/EventHandler.cs:497)
Opsive.UltimateCharacterController.Inventory.InventoryBase.AddItem (Opsive.UltimateCharacterController.Items.Item item, 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)

Which happens on 'play'
I then realized the only key that actually causes anything to happen when holding an item is the Toggle Item Equip, and once it's been done once is the
KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[Opsive.UltimateCharacterController.Items.Item,UnityEngine.GameObject[]].get_Item (Opsive.UltimateCharacterController.Items.Item key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
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, Int32 slotID) (at Assets/Opsive/UltimateCharacterController/FirstPersonController/Scripts/Character/FirstPersonObjects.cs:295)
Opsive.UltimateCharacterController.FirstPersonController.Items.FirstPersonPerspectiveItem.StartEquip (Boolean immediateEquip) (at Assets/Opsive/UltimateCharacterController/FirstPersonController/Scripts/Items/FirstPersonPerspectiveItem.cs:763)
Opsive.UltimateCharacterController.Items.Item.StartEquip (Boolean immediateEquip) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Item.cs:363)
Opsive.UltimateCharacterController.Character.Abilities.Items.EquipUnequip.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/EquipUnequip.cs:544)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.UpdateAbilities (Opsive.UltimateCharacterController.Character.Abilities.Ability[] abilities) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:622)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.UpdateUltimateLocomotion () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:549)
Opsive.UltimateCharacterController.Character.CharacterLocomotion.Move (Single horizontalMovement, Single forwardMovement, Single deltaYawRotation) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/CharacterLocomotion.cs:455)
Opsive.UltimateCharacterController.Game.DeterministicObjectManager+DeterministicCharacter.FixedMove () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/DeterministicObjectManager.cs:146)
Opsive.UltimateCharacterController.Game.DeterministicObjectManager.FixedUpdate () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/DeterministicObjectManager.cs:589)

I'm not sure if it's really necessary to repost them but I assumed it couldn't hurt.
I'm also not sure which portion in setup I could be doing wrong to get it to do this, but I'm following all the steps as I see them.
 
All of the above, for the most part. For getting the first person segment I watched the video on setting up the character and the one on item creation
Same for the third with the two third videos.
I found out what was causing the key exception, I didn't have the third person arms in the right place. When I wasn't using the arms I was telling it to go in the first person objects tab, they wouldn't work there without actual arms though it seemed? After that I was able to get the first person item, or at least an assault rifle, to function.

But anytime I try to do anything with either a first and third person, or with just the third person, it locks up after the first 'shot'. The use won't become inactive, no error or anything. Just... Use locks in as (Active).

Which was fixed when I just made another new scene and did the same steps, just without the first person anymore (I seem to have a lot of trouble setting both up together), and was able to get it firing in third person but now the sword is locking up not exiting 'Use'



I'm going to spend some more time combing it over(the videos and documentation) to try and get it functioning, I just didn't want to leave your question hanging when you're trying to help me. Since the problem I'm having now is something different if I can't solve it with just paying closer attention to the videos I'll likely make a different thread to address that.

Thank you and have a nice Halloween if you celebrate it.
 
I'm glad that you are making progress :)
I didn't have the third person arms in the right place.
Do you mean the first person arms? The third person arms will come from the model itself. The first person arms should get added under the First Person Objects GameObject.
and was able to get it firing in third person but now the sword is locking up not exiting 'Use'
Is the correct animation playing? It sounds like it could be related to the use event not firing.
 
Shhh. Yes, first arms >.> I've been thinking and typing them so much right now that they're blurring together when I'm speaking/typing.

In the situation where it was locking up there actually wasn't an animation playing, the sound was, and I think I found out what was causing that, and I think it's a bug that I've been able to recreate
(I've actually fallen into a good rhythm of making a new scene and dropping the character and terrain in for quickly trying to repeat my problems)

Whenever I told the Sword item I was making to use the Sword Profile it would lock into the use, not play the animation, and only play the sound. Giving a few errors on it.

NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Items.Actions.MeleeWeapon+MeleeHitbox.ResetPositionRotation () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/MeleeWeapon.cs:90)
Opsive.UltimateCharacterController.Items.Actions.MeleeWeapon.StartItemUse () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/MeleeWeapon.cs:386)
Opsive.UltimateCharacterController.Character.Abilities.Items.Use.AbilityStarted () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/Use.cs:449)
Opsive.UltimateCharacterController.Character.Abilities.Ability.StartAbility (Int32 index) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Ability.cs:363)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Items.ItemAbility itemAbility, Boolean ignoreCanStartCheck) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:1074)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability, Boolean ignorePriority, Boolean ignoreCanStartCheck) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:880)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability, Boolean ignorePriority) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:866)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:855)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.TryStartAbility (Opsive.UltimateCharacterController.Character.Abilities.Ability ability) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:233)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.UpdateAbilityInput (Opsive.UltimateCharacterController.Character.Abilities.Ability[] abilities) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:121)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.UpdateAbilityInput () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:87)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotionHandler.Update () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotionHandler.cs:73)

NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Items.Actions.MeleeWeapon+MeleeHitbox.CanUse () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/MeleeWeapon.cs:101)
Opsive.UltimateCharacterController.Items.Actions.MeleeWeapon.UseItemUpdate () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/MeleeWeapon.cs:415)
Opsive.UltimateCharacterController.Character.Abilities.Items.Use.LateUpdate () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/Abilities/Items/Use.cs:566)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.LateUpdateActiveAbilities (Opsive.UltimateCharacterController.Character.Abilities.Ability[] abilities, System.Int32& abilityCount) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:843)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.LateUpdateUltimateLocomotion () (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:831)
Opsive.UltimateCharacterController.Character.CharacterLocomotion.Move (Single horizontalMovement, Single forwardMovement, Single deltaYawRotation) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/CharacterLocomotion.cs:476)
Opsive.UltimateCharacterController.Game.DeterministicObjectManager+DeterministicCharacter.FixedMove () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/DeterministicObjectManager.cs:146)
Opsive.UltimateCharacterController.Game.DeterministicObjectManager.FixedUpdate () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/DeterministicObjectManager.cs:589)

NullReferenceException: Object reference not set to an instance of an object
Opsive.UltimateCharacterController.Items.Actions.MeleeWeapon+MeleeHitbox.ResetPositionRotation () (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/MeleeWeapon.cs:90)
Opsive.UltimateCharacterController.Items.Actions.MeleeWeapon.OnChangePerspectives (Boolean firstPersonPerspective) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/MeleeWeapon.cs:712)
Opsive.UltimateCharacterController.Events.InvokableAction`1[System.Boolean].Invoke (Boolean arg1) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/InvokableAction.cs:87)
Opsive.UltimateCharacterController.Events.EventHandler.ExecuteEvent[Boolean] (System.Object obj, System.String eventName, Boolean arg1) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/EventHandler.cs:392)
Opsive.UltimateCharacterController.Character.UltimateCharacterLocomotion.OnAttachLookSource (ILookSource lookSource) (at Assets/Opsive/UltimateCharacterController/Scripts/Character/UltimateCharacterLocomotion.cs:463)
Opsive.UltimateCharacterController.Events.InvokableAction`1[Opsive.UltimateCharacterController.Character.ILookSource].Invoke (ILookSource arg1) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/InvokableAction.cs:87)
Opsive.UltimateCharacterController.Events.EventHandler.ExecuteEvent[ILookSource] (System.Object obj, System.String eventName, ILookSource arg1) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/EventHandler.cs:392)
Opsive.UltimateCharacterController.Camera.CameraController.InitializeCharacter (UnityEngine.GameObject character) (at Assets/Opsive/UltimateCharacterController/Scripts/Camera/CameraController.cs:377)
Opsive.UltimateCharacterController.Camera.CameraController.OnDestroy () (at Assets/Opsive/UltimateCharacterController/Scripts/Camera/CameraController.cs:870)

Also when these happen if I enter aiming it plays the animation suddenly, but the model freezes up once its over and power slides all over the place in movement, and then aiming again causes some glitch-y camera jumping.

In this I was setting the camera, and character, up to Third Person Combat, without any First Person options.

If I don't use a 'Profile' for the sword it works fine though.




Other notes
In Third Person Adventure when the sword swing animation plays if the character isn't looking directly away from the camera the arms start playing through the body awkwardly.
In both Third Person Adventure and Combat the model power slides around in any direction when the use animation plays, the legs remaining still even though I can move around freely. Occasionally if I jiggle around a lot I've kind of broken all the animations and frozen all the limbs in positions.
 
It looks like the preset references some UnityEngine objects that it shouldn't be references. I'll have it fixed for the next version.

In Third Person Adventure when the sword swing animation plays if the character isn't looking directly away from the camera the arms start playing through the body awkwardly.
In both Third Person Adventure and Combat the model power slides around in any direction when the use animation plays, the legs remaining still even though I can move around freely. Occasionally if I jiggle around a lot I've kind of broken all the animations and frozen all the limbs in positions.
Are you able to reproduce it within the demo scene? I tried attacking with the sword and haven't been able to reproduce it.
 
I haven't tried with the demo scene, I was working in a fresh scene with only a blank terrain, aside from the needed things. Those spawned by the setup buttons, Nolan, and the Camera.
 
Top