Circular health bar

I want to display a circular health bar under my Player and enemies. I know about this and I did it like that (and it works). I even created a new Shader for it, so I have an additive shader with a cutoff.

But now I figured I want something more…I have many different enemies with different amount of health, ranging from 5 HP to a couple of hundreds. I want the player to immediately see, what he is up against, so instead of a continuous lifebar, I would like to have little ticks or dots spaced evenly around the enemy. Is that possible/feasible (without creating an extra texture for each enemy)?

I would personally achieve this using UIToolkit with the following considerations:

  • Only display for enemies that are displayed on screen renderer.isVisible.
  • Convert enemy position from world coordinates into screen coordinates (for placement of overlay). The benefit of this would be consistent scaling regardless of distance to player (if that is desirable for your game).
  • Pool these overlays to improve performance and reduce memory overhead.

Plus UIToolkit combines each of these into a single draw call which is very useful.

i think you can using the 3d object. For example : you make one circular 3d object.you use tiling texture. you proportion enemy’s health with the number of tile and you set texture offset.