Health Display stopped working

The enemy health display still works and the health of all entities still works with them dying eventually, but the health display for the player stays at the default. Getting this error: KeyNotFoundException: The given key ‘Health’ was not present in the dictionary.

A KeyNotFoundException is because you are looking for ‘Heath’ in a dictionary, but it doesn’t exist. Check your stats and make sure there is a ‘Health’ entry. I believe the key may be case sensitive which means ‘Health’ and ‘health’ is not the same thing.

There is a Health in stats with the capitalization.

Well, according to the code there isn’t. Do you have the stats referenced? Do you have the correct stats referenced?

Figured it out. When I added the XPToLevelUp to the Player class in the Progression, I accidentally deleted the Health stat from there. Maybe that’s what you meant, I thought you were talking about the enums in script.

1 Like

Yeah, that’s the one. Great job finding it.

Yes, it’s easy to accidentally overwrite an entry in the Progression, as Unity’s default array propertydrawer isn’t that great with nested arrays. Generally a KeyNotFound in Progression is a result of this.

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

Privacy & Terms