Easy polish on Health UI

I don’t know if this is covered later in the course but here’s a few simple things to make the UI a bit more pleasing to the eye.

MAKE UI FACE CAMERA;

Simply get the main camera and get the parent objects forward vector to always equal the cameras forward vector. You could also do this with Quaternion.LookAt().

UI CHANGE COLOR BASED ON HEALTH

Make a Gradient and set colors in inspector, save colors as preset under the window

image
image

The Gradients values go from 0…1 so type this code to get a colorvalue between 0-1 (which the fill amount already calculates to) and plug that in. Now you healthbar will change it’s color based on how much health is left.

1 Like

I like the gradient idea! Thanks for sharing!

Privacy & Terms