Easy Enemy Health Bars in Unity

Поділитися
Вставка
  • Опубліковано 1 жов 2024
  • The main difference between a Player's Health Bar in the HUD vs an Enemy's is creating the Health Bar in WORLD SPACE.
    In stead of overlaying UI on the Camera, the Enemy or Game Object itself has a Canvas attached to it as a child object, and the UI is a part of the Enemy GameObject.
    The benefit of this is the Health Bar follows the Enemy around, the downside is we need to make sure it stays oriented and positioned properly as it does.
    Learn all about how to solve for that easily here without needing a single asset of your own.
    Using Unity's Slider UI component out of the box we can use the guts of that to make a working health bar in close to 5 lines of code.

КОМЕНТАРІ • 55