Hello, guys. Now I’m facing with another issue. I made texture for the player’s health. I used OnGUI () to make it. When the health drops, I reduce the width of the GUI. However, when it is reduces, it also affects the height. So how can I solve that? Thank you!
Here is my code :
var healthBar : Texture2D;
var health : int = 100;
function OnGUI ( ) {
var screenPos : Vector3 = camera.main.WorldToScreenPoint (transform.position);
GUI.Label (Rect (screenPos.x, Screen.height - screenPos.y, health / 2, 100), healthBar);
}
Can you show us your current script?
– GradesFisher