This project provides a Unity script for managing the health bar of game characters. The class should be attached to game objects that have a CharacterHealthController component. The health bar and health slot prefabs need to be specified in the Unity Editor. This class dynamically adjusts the size of the health bar to reflect the character's current health.
In your Unity project, clone this repository at any location using Git.
- In the Unity Editor, attach this script to game objects that have a CharacterHealthController component.
- Specify the health bar and health slot prefabs.
healthBar
: The health bar prefab. This prefab will dynamically change its size according to the character's health.healthSlot
: The health slot prefab.
During each frame update, this script gets the current health percentage of the character and dynamically changes the size of the health bar.
If you have any questions or suggestions, feel free to provide feedback via issues or pull requests.
This project uses the MIT open source license. Everyone is welcome to improve and use the project.