Skip to main content

Static Health Bar


Static Health Bar (Screen-Space)

Use Static Bar when you need a bar fixed at a UI location (for example, top-left player HP), instead of following a world-space target.


1) Add a Prefab to Canvas

From:

Assets/SoftKitty/MasterHealthBarSystem/Prefabs

Choose the desired bar style prefab and place it under your scene Canvas.


2) Enable Static Bar Mode

On the prefab instance, open BarUI and enable:

  • Static Bar

This prevents world-to-screen tracking behavior.


3) Initialize in Script

Call BarUI.Init(...) in Start:

public BarUI playerBar;

void Start()
{
playerBar.Init(null, BarStyle.HealthBall, "DemoPlayer");
}

Method signature:

public void Init(HealthBar _bar, BarStyle _style, string _barUid, int _index = 0, Vector2 _size = default)

4) Optional Entity Binding

If your project uses SoftKitty shared data, bind this static bar to an entity:

playerBar.LinkEntity(EntityManagerObject.instance.GetEntity("player"));

Method signature:

public void LinkEntity(Entity _entity)

Common Notes

  • For standalone mode, skip LinkEntity(...) and drive values manually.
  • Keep bar UIDs aligned with entries in BarSettings.
  • You can create separate static bars for HP, shield, boss HP, or party status.