How do I resize the image on a GUILayout?

I need help to resize the image on my GUILayout so the images are placed add middle of the screen please help me :slight_smile:

var ResumeGui : GUIStyle;
var RestartGui : GUIStyle;
var MainMenuGui : GUIStyle;

var Player : Transform;
private var GuiEnabled = false;
 
function Start(){
 Time.timeScale=1;
 GuiEnabled = false;
 
 
}  

function Update(){
 if(Input.GetKeyUp("escape")){
  if(GuiEnabled==true){ 
     GuiEnabled = false;
     Time.timeScale=1;
     AudioListener.volume=1;
     Screen.showCursor=false;
    }
    else if(GuiEnabled == false){
     GuiEnabled = true; 
     Time.timeScale=0;
     AudioListener.volume=0;
     Screen.showCursor=true;
}
}
}


function OnGUI(){
  if(GuiEnabled==true){ 
   if(GUILayout.Button (".", ResumeGui)){
     Time.timeScale=1;
     AudioListener.volume=1;
     Screen.showCursor=false;
     GuiEnabled = false;
     }
    }
  if(GuiEnabled==true){ 
   if (GUILayout.Button (".", MainMenuGui)){  
     Time.timeScale=1;
     AudioListener.volume=1;
     GuiEnabled=false;
     Application.LoadLevel(0);
    }
   }
  if(GuiEnabled==true){ 
   if (GUILayout.Button (".", RestartGui)){  
     Time.timeScale=1;
     AudioListener.volume=1;
     GuiEnabled=false;
     Player.position.x = 320.8074;
	 Player.position.y = 20.97857;
	 Player.position.z = 70.35075;
	 Player.rotation.x = 0;
	 Player.rotation.y = 0;
	 Player.rotation.z = 0;
	 Player.rigidbody.velocity = Vector3.zero;
     Player.rigidbody.angularVelocity = Vector3.zero;
   }
  }
  
}

Okey:

  • GUI Style: If you are using this, you need to resize the image manually and for the aligment see the style editor in inspector window.
  • GUI.DrawTexture(Rect(Position of x, Position of y, Width, Height),name of the texture);
  • Hope it helps ^^