UIHealthBar - jimdroberts/FishMMO GitHub Wiki
UIHealthBar
is a UI component in the FishMMO client that displays the player's health. It inherits all resource bar logic from UIResourceBar
and is specialized for showing health values.
UIResourceBar
- (All fields are inherited from
UIResourceBar
)
- (All methods are inherited from
UIResourceBar
)
- Attach
UIHealthBar
to a UI GameObject in the Unity Editor. - Assign the
slider
andresourceValue
fields in the Inspector. - Set the
Template
field to the health attribute template.
// Example: Using UIHealthBar in a scene
UIHealthBar healthBar = GetComponent<UIHealthBar>();
healthBar.slider = ...; // Assign Slider
healthBar.resourceValue = ...; // Assign TMP_Text
healthBar.Template = healthTemplate; // Assign CharacterAttributeTemplate for health
- Use
UIHealthBar
for health display and inherit fromUIResourceBar
for other resource bars. - Always assign all required fields in the Inspector to avoid null references.
- Ensure the correct attribute template is set for health.