Scaling guitexture gameobject

Hi, i’m working for mobile games and i have currently 3 guitexture gameobject that use for virtual joystick, how can i scale these guitexture? since i did not drawing this texture using script so it’s not draw by calling function OnGUI() so i can’t use this code for scaling

function OnGUI()
{
	var svMat = GUI.matrix;
	scale.x = Screen.width/originalWidth;
    scale.y = Screen.height/originalHeight;
    scale.z = 1;
    GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, scale);

drawPause();

GUI.matrix = svMat;

One solution is to modify the GUITexture.pixelInset. You can resize by changing the ‘width’ and ‘height’, but if you have it anchored in the center, you must also adjust the ‘x’ and ‘y’.

Here is a function that resizes the GUITexture on the same game object as this script:

function ResizeGUITexture(widthScale : float, heightScale : float) {
	var rect = guiTexture.pixelInset;
	rect.width *= widthScale;
	rect.height *= heightScale;
	rect.x = -rect.width / 2.0;
	rect.y = -rect.height / 2.0;
	guiTexture.pixelInset = rect;
}