- Home /
scaling a gui texture
I've asked this on the forum, but haven't been given too much direction yet, hoping for some more information.
In my playerCollision file I set the variable when objects get picked up:
ScoreKeeper.temperatureAdjust = 5 ;
In my scorekeeper file I apply different textures and track the temperature, displaying a different picture with a higher temperature based on time minus the number from picked up objects that keep things cool.
static var temperatureAdjust : int = 0 ;
function Update () { TemperatureUpdate(); }
function TemperatureUpdate () {
var temperature : int = (Time.time - temperatureAdjust) ;
if ((temperature >= 111 ) && (temperature <= 120)) { guiTexture.texture = temperature12tex; guiTexture.enabled = true ; } else if ((temperature >= 101 ) && (temperature <= 110)) { guiTexture.texture = temperature11tex; }
I'm not quite sure why the above isn't working. The the if statements continue in increments of 10, until it gets to zero, where the game begins.
This is basically an alternative to a timer, based on keeping down the temperature. I'm trying to figure out what might be wrong with this, and also if possible just scale the gui instead of using different textures, because it would be more accurate and require less images to load.
thanks for any help with this.
Answer by Daniel 6 · Jul 12, 2010 at 06:54 PM
It is possible to scale a GUITexture by changing it's pixelInset variable. Here's a sample:
guiTexture.pixelInset.width += 20;
Answer by Tetrad · Jul 12, 2010 at 06:51 PM
Instead of using a GUI Texture, consider using just a regular texture on a quad that's either a child of the camera (so it stays in the same place when the camera moves) or rendered using a separate camera. That way you can scale it, move it, or change the material just like any other game object.
Your answer
![](https://koobas.hobune.stream/wayback/20220613064458im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Textures in GUI being scaled slightly? 1 Answer
How do you auto scale the space between Gui Buttons? 1 Answer
Aspect ratio keeping guitexture scaling 1 Answer
Cooldown indication, transparent rotating texture 1 Answer
Timer progress bar 0 Answers