Skip to content

A simple health script for unity game projects. If you find any issues or have any suggestions feel free to tell me :D

License

Notifications You must be signed in to change notification settings

MaxGreenhill8529/Unity-Health-Script

Repository files navigation

Unity-Health-Script

Health Inspector

How To Use

Dealing Damage

To deal damage call the Damage(int amount) function. When damage is taken all events in the OnDamage UnityEvent will be invoked and if health is <= 0 then OnDeath will be invoked aswell.

Note

OnDeath is invoked AFTER OnDamage and not instead of.

Healing

To heal call the Heal(int amount) function. This function will invoke all events in the OnHealh UnityEvent.

Subscribing / Unsubscribing From Events

If you would like to subscribe to the events through scripts you can call SubscribeTo...(UnityAction action) followed by the name of the corresponding Unity Event. Ex: SubscribeToOnDeath(UnityAction action). To unsubscribe is the same process but instead you call UnsubscribeFrom...(UnityAction action) with the UnityAction you wish to remove from the Event.

About

A simple health script for unity game projects. If you find any issues or have any suggestions feel free to tell me :D

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages