Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

Retrieving the amount of scaling from the Canvas Scaler

$
0
0
Dear Unity users,

I am currently working on a healthbar which slowly drains the less health you have. I followed this tutorial to get the healthbars I wanted:

In short, it uses a mask layer and a seperate green bar to indicate the amount of health. By moving the green bar to the left, it disappears behind the mask layer and thus shows less and less health.
The method to calculate its position based on the amount of health is here:
Code (CSharp):
  1.    
  2.  
  3. float...
Retrieving the amount of scaling from the Canvas Scaler

Viewing all articles
Browse latest Browse all 1466670

Trending Articles