KeyNotFoundException

I am getting this error when my enemy attempts to do damage to me:

KeyNotFoundException: The given key ‘Damage’ was not present in the dictionary.
System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) (at <9aad1b3a47484d63ba2b3985692d80e9>:0)
RPG.Stats.Progression.GetStat (RPG.Stats.Stat stat, RPG.Stats.CharacterClass characterClass, System.Int32 level) (at Assets/Scripts/Stats/Progression.cs:17)
RPG.Stats.BaseStats.GetBaseStat (RPG.Stats.Stat stat) (at Assets/Scripts/Stats/BaseStats.cs:51)
RPG.Stats.BaseStats.GetStat (RPG.Stats.Stat stat) (at Assets/Scripts/Stats/BaseStats.cs:46)
RPG.Combat.Fighter.Hit () (at Assets/Scripts/Combat/Fighter.cs:85)
RPG.Combat.Fighter.Shoot () (at Assets/Scripts/Combat/Fighter.cs:98)

What is missing in the Dictionary that is causing my enemies to no longer do damage?

‘Damage’

As the error states, there is no entry in the dictionary with a ‘Damage’ key.

Found it. Back when Damage was added to the Stats.cs file there was a part I managed to gloss over that added the Damage to the enemy classes on the Progression.asset file. That is where the key was missing.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms