- Home /
Question by
mikhailovic · Jul 15, 2014 at 03:42 PM ·
guitexturewidthreduce
My GUITexture shrinks on both sides
Hi i want my GUITexture to shrink from the left to the right with my script. But as it shrinks to the right the right side expands to the right, allthough a small ammount its enough to be noticeable.
http://gyazo.com/4dd235c4e8ff71c4f7c6c6710f381aec
http://gyazo.com/4b29e490c2bf57f06f756c4641bde8e3
Why doesnt it just reduce from the left to the right, instead of what you can see in the two pictures?
CODE if it may help.
#pragma strict
var BatteryLife : GUITexture;
private var fl : Flashlight;
var width : float = -116;
function Start ()
{
fl = GameObject.Find("Flashlightt").GetComponent(Flashlight);
BatteryLife.guiTexture.pixelInset = Rect (505.5, 221, -116, 35);
BatteryLife.guiTexture.enabled = false;
}
function Update ()
{
if(Input.GetKeyDown("n"))
{
if(BatteryLife.guiTexture.enabled == false)
{
BatteryLife.guiTexture.enabled = true;
}
else
{
BatteryLife.guiTexture.enabled = false;
}
}
BatteryDrain();
}
function BatteryDrain ()
{
BatteryLife.guiTexture.pixelInset.width = (fl.batteryLife * width) / 0.6;
}
Comment
Your answer
Follow this Question
Related Questions
Reduce Draw call for Multiple GUI Textures with same Texture 1 Answer
Exception: not implemented 1 Answer
reduce the GUITexture drawcalls 2 Answers
Change GUITexture width 1 Answer
How do I adjust a GUITextures width, from the left? 1 Answer