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 Mr_MP · Feb 22, 2012 at 09:59 PM · guilabelbox

Trouble Positioning a GUILayout.Label, or as a button?

Hey guys, I'm having my trouble positioning my GUILayout.Label (GUILayout.Label("Current Quality Setting: "+QualitySettings.currentLevel)); to the position that I want.

It's currently like this:

http://i43.tinypic.com/1z4a9tf.jpg

Lazy Link

(Picture is to big to paste here)

This is the code affiliated with this particular area (I've edited out the 500 lines of menu code that doesn't matter to make it more readable to you guys):

**using UnityEngine; using System.Collections; public class TitleMenu : MonoBehaviour { public bool isMain = true; public bool isOptions = false; public bool isGraphics = false;

 public int slboWidth = 220;
 public int slboHeight = 210;
 
 public int slbuWidth = 200;
 public int slbuHeight = 40;
 
 public int spacing = 10;
 
 void Update()
 {
     if(Input.GetKeyDown("escape") && isOptions)
     {
         isOptions = false;
         isMain = true;
     }
     if(Input.GetKeyDown("escape") && isGraphics)
     {
         isGraphics = false;
         isOptions = true;
     }
 }
 
 void OnGUI()
 {
 if(isGraphics)
     {
         GUI.Box(new Rect(Screen.width/2 - slboWidth/2, Screen.height/2 - slboHeight/2, slboWidth, slboHeight), "");
         
         // I Want the QualitySettings.currentLevel (The "Current Quality Setting" string doesn't really matter to me)
         GUILayout.Label("Current Quality Setting: "+QualitySettings.currentLevel);
         
         // QualitySettings.currentLevel must go in the button (At the position) created below this line
         GUI.Button(new Rect(Screen.width/2 - lboWidth/2 + spacing, Screen.height/2 - slboHeight/2 + spacing, slbuWidth, slbuHeight),  "");
         if(GUI.Button(new Rect(Screen.width/2 - slboWidth/2 + spacing, Screen.height/2 - slboHeight/2 + 60, slbuWidth, slbuHeight), "Increase"))
         {
             QualitySettings.IncreaseLevel();
         }
         
         if(GUI.Button(new Rect(Screen.width/2 - slboWidth/2 + spacing, Screen.height/2 - slboHeight/2 + 110, slbuWidth, slbuHeight), "Decrease"))
         {
             QualitySettings.DecreaseLevel();
         }
         
         if(GUI.Button(new Rect(Screen.width/2 - slboWidth/2 + spacing, Screen.height/2 - slboHeight/2 + 160, slbuWidth, slbuHeight), "Back"))
         {
             isGraphics = false;
             isOptions = true;
         }
     }
 }

}**

Or:

http://pastebin.com/hQYPHNb6

Lazy Link

Any help would be appreciated!

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

0 Replies

· Add your reply
  • Sort: 

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

OnGUI Labels affect different boxes? 1 Answer

Why GUI Doesn't appears? 1 Answer

Possible to change GUI.Label fontsize without using GUIStyle? 1 Answer

GUIBox fontSize without changing other labels? 3 Answers

Gui label variable as a string.. 1 Answer


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