- Home /
Changing pixel inset of GUI texture from scripting
How would I change the pixel inset width and height part of the GUI texture component from scripting? I am trying to make a 50x50 pixel inset width and height texture change to become 100x100.
Comment
Best Answer
Answer by Peter G · Jan 18, 2011 at 11:48 PM
You just have to assign the pixelInset a new rect:
var newInset : Rect = new Rect(50, 50, 100, 100); //Rect (x, y, width, height) from the bottom left corner.
guiTexture.pixelInset = newInset;
or in JS, you can edit each value of the rect induvidually.
guiTexture.pixelInset.x = 50;
guiTexture.pixelInset.y = 50;
//and so forth.