Quantcast
Channel: Latest Questions by Fox-Handler
Viewing all articles
Browse latest Browse all 90

Health Bar doesn't scale evenly with damage

$
0
0
I was trying to make a health bar for my character and I have a model that scales on the x axis whenever the player takes damage but, it doesn't scale evenly. How could i fix this? Is it easier to just use a GUI texture? public override void TakeDamage (float dmg) { gui.PlayerHealth(dmg/Health); base.TakeDamage (dmg); } using UnityEngine; using System.Collections; public class GameGUI : MonoBehaviour { public Transform HealthBar; public void Start() { HealthBar.localScale = Vector3.zero; } public void PlayerHealth(float dmg) { HealthBar.localScale = new Vector3(dmg,1,1); } }

Viewing all articles
Browse latest Browse all 90

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>