I’m hoping someone else encountered the same error and can help.
I was following along with Sam in this video “Debug Health Display” and at the 9:30 time stamp he added the “String.Format” namespace, and completed the final format of line 18. When he goes back to play test the Health Display now shows the decrease in the players health in a full percent value (not a decimal value) anymore. I tried the same thing, but when I now start the game, I am getting a Object reference not set to an instance of an Object error in line 18 of the HealthDisplay.cs script.
I went back to look at the script and I don’t think I made any errors. I can’t determine where this missing reference is.
The big issue in the game now, is I can one punch enemies, and they can one punch me.
Did some play testing…
FIXED - the one punch issue. The progression levels seemed to have disappeared. So I added them back and now everyones hit points are normal. No more one punch death going on.
ERROR - Error ONLY happens once I attach the HealthDisplay script to the Health Value object under the HUD we created. Also, once added my health value doesn’t go down on the hud, yet my players HP’s are going down in the Inspector. If I don’t add it… Game runs fine. So still the same problem I cant seem to fix.