Back to Browse

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

89.2K views
May 2, 2015
23:31

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, healthBar.transform.localScale.z); } ➤ Tutorial Look to Camera: https://www.youtube.com/watch?v=ViZto58MgjM&list=PLj0TSSTwoqAyOvc2zvdWNoO-jtMZkMDIC&index=10 My Udemy Courses (up to 90% Discount) ➤ Galaga 3D : http://bit.ly/2IZQhrs ➤ Mastermind 2D : http://bit.ly/2CRoQf6 ➤ Ear money with Unity : http://bit.ly/2OZ9Akn ➤ Whack a Mole 3D : http://bit.ly/2BBxMb5 ➤ Asteroids 3D : http://bit.ly/2LgdEj4 ➤ PacMan 3D : http://bit.ly/2tHZBrQ ➤ Memory 2D : http://bit.ly/2EPZw8J ➤ Inkscape NewB to Pro: http://bit.ly/2UC4qxr ➤ My Unity Assets: http://bit.ly/2E34Yqz ➤ My Webshop: https://www.octomangames.com/shop ➤ My Asset on CubeBrush: https://cubebrush.co/octoman ➤ Me on Sketchfab: https://sketchfab.com/octoman ➤ Me on CgTrader: https://www.cgtrader.com/xoctomanx Support me: ➤ Support me on Patreon: https://goo.gl/bxyM4Z ➤ Want to use Patreon too? https://goo.gl/zkDJrg ➤ Donate with PayPal: https://goo.gl/dGcSCV Social Media: ➤ Twitter: http://twitter.com/mr_octoman ➤ Facebook: https://www.facebook.com/profile.php?id=100010598523392 ➤ My Website: https://www.octomangames.com ➤ My Website Hoster: http://goo.gl/vWyQiz DISCLAIMER: All content shown in this video is made by myself. This does not include software i use. Youtube / Google is allowed to show & promote my content worldwide. Because of european article 13 now 17 i write this disclaimer here.

Download

0 formats

No download links available.

Unity 5 Tutorial: Easy Health Bar C# - using localScale | NatokHD