dimanche 24 juin , 2018
Home / CRYENGINE / Unity 5 Tutorial: Easy Health Bar C# – using localScale

Unity 5 Tutorial: Easy Health Bar C# – using localScale



In this small tutorial i will show you how to create a very easy & basic HealthBar with the new canvas system in Unity 5.
▼▼▼ More Infos here: Check em out! ▼▼▼

Basic Workflow:
– set the canvas to world & resize it
– create images for border, background and bar
– write the healthbar function and implement your damage system to that

Change the code to clamp the Bar between 0 and 1 so no overflow happends..
————————————————————————————————————–
public void SetHealthBar(float myHealth){
healthBar.transform.localScale = new Vector3(Mathf.Clamp(myHealth,0f ,1f),
healthBar.transform.localScale.y,

Découvrir l’article original