The HealthDisplay
is really a q&d approach. Updating the UI on every Update()
when most of the time its value doesn’t change… getting the component in Update()
again and again (well, I certainly didn’t do that although I still did a fairly q&d implementation for it by adding a [SerializeField]
to throw the UI text field into). And not using TMPro
also means no easy outline or shadow for the text on the screen…
This might be the UI code to do in a Game Jam…
Side-node: I put the script on the canvas, not the text field…
I’d rather have one “HUD” UI canvas object being in control for all the UI elements that are beneath it in the UI object hierarchy than scattering scripts over random items. Maybe if there was some UI with health/mana/etc bars rendered in world-space above each character, but then it would still be that one UI canvas to put on each character…