I am trying to create a health bar for an enemy which follows the enemy on the screen above its head. Everything works fine, however I have a problem with the GUI Texture component when I try to change the width via java.
Here is the code:
var HealthPercentage:float;
HealthPercentage = Health/StartingHealth;
if(transform.FindChild("HealthBar"))
{
var barStart:float;
var barWidth:float;
barStart = transform.FindChild("1x1Border").GetComponent(GUITexture).guiTexture.pixelInset.width;
barWidth = barStart*HealthPercentage;
}