https://github.com/5u4/unity-health-bar
💕 A cool interactive unity health bar
https://github.com/5u4/unity-health-bar
health-bar module package unity
Last synced: about 1 year ago
JSON representation
💕 A cool interactive unity health bar
- Host: GitHub
- URL: https://github.com/5u4/unity-health-bar
- Owner: 5u4
- License: mit
- Archived: true
- Created: 2018-11-15T02:52:51.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-11-15T23:06:31.000Z (over 7 years ago)
- Last Synced: 2024-08-03T05:18:33.851Z (almost 2 years ago)
- Topics: health-bar, module, package, unity
- Language: C#
- Homepage: http://u3d.as/1nts
- Size: 1.59 MB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README

## Description
A prefab that shows a character's health.
## Demo

## How to use
1. Drag the prefab into the `Hierarchy`.
2. Make sure an `EventSystem` exists in the `Hierarchy`. (If not, you can create one by creating a `canvas` element then delete it)
3. Set health
```cs
public float maxHealth;
public float currentHealth;
public HealthBar healthBar;
private void Start() {
healthBar.SetMaxHealth(maxHealth);
healthBar.SetCurrentHealth(currentHealth);
}
```
4. Update current health when damaged or healed
```cs
currentHealth -= damage;
healthBar.SetCurrentHealth(currentHealth);
```
## Video
```
// TODO: Add a tutorial video while there are plenty enough types of health bars
```
## Unity assets store
http://u3d.as/1nts