Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by xampozz · May 26, 2013 at 09:27 PM · javascriptjavaguilayoutgui layout

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 :)

 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;
    }
   }
   
 }            
      
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Kirbyrawr · May 26, 2013 at 09:37 PM

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 ^^

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image xampozz · May 26, 2013 at 10:43 PM 0
Share

Thank you it helped alot :)

avatar image xampozz · May 26, 2013 at 10:47 PM 0
Share

Thank you it helped alot :)

avatar image Kirbyrawr · May 26, 2013 at 10:51 PM 0
Share

Happy to hear it, click on the tick for close this answer ^^ Good Deving!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

14 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Have a 'Torch' script toggle on and off 1 Answer

an object seemingly cannot access a value in other. 1 Answer

Ladder script not working? 0 Answers

How to disable "GameObject" Then Enable After Animation. 1 Answer

How to display GUI in sequence in trigger 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges