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 SLIMEBASS · May 01, 2013 at 03:09 PM · guiqualityrightcornertop

Making this in the top right corner? (GUI)

How can i make this in the top right corner?

 var names = QualitySettings.names;
 
 for (var i = 0; i < names.Length; i++)
 {
     if (GUILayout.Button (names[i]))
     QualitySettings.SetQualityLevel (i, true);
 }
Comment
Add comment · Show 1
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 Fornoreason1000 · May 01, 2013 at 05:51 PM 0
Share

you mean the GUI layout Button...

1 Reply

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

Answer by Fornoreason1000 · May 01, 2013 at 05:55 PM

Im assuming you talking about the button (; do you know about Layout areas? well you will need them in this case because your using a loop. define them in the loop so that the Y coordinate increases each loop. so they will not draw over each other. set the areas x pos to Screen width - button width to make in the right, and y to 0 + i * (insert you height here) to make the list go downwards. the width and height of the buttons is up to you.

for more info read this: http://docs.unity3d.com/Documentation/Components/gui-Layout.html

    var names;


 function Awake() {
  names = QualitySettings.names;
 
 }
 function OnGUI() {
     
    
     for (var i = 0; i < names.Length; i++) {
 
         GUILayout.BeginArea(Rect(Screen.width - 130, 0 + 20 * i, 120, 30));
         if (GUILayout.Button(names[i])) {
             QualitySettings.SetQualityLevel(i, true);
         }
         GUILayout.EndArea();
         
     }
     
     
 }
     
 


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 SLIMEBASS · May 01, 2013 at 06:33 PM 0
Share

Got some errors: get_names can only be called from the main thread. Constructors and field initializers will be executed from the loading thread when loading a scene. Don't use this function in the constructor or field initializers, ins$$anonymous$$d move initialization code to the Awake or Start function.

And

ArgumentException: get_names can only be called from the main thread. Constructors and field initializers will be executed from the loading thread when loading a scene. Don't use this function in the constructor or field initializers, ins$$anonymous$$d move initialization code to the Awake or Start function. Settings..ctor () (at Assets/$$anonymous$$yThings/$$anonymous$$yScripts/Settings.js:1)

avatar image Fornoreason1000 · May 01, 2013 at 06:41 PM 0
Share

yeah... QualitySettings.names is one of those function you have to call in Awake or Start(), I forgot to put that in, I've edited it now

avatar image SLIMEBASS · May 01, 2013 at 06:45 PM 0
Share

Thanks alot :D

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

13 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

Related Questions

GUI Texture on bottom left/right corners 3 Answers

What should I do for my Toolbar to work properly? 0 Answers

How can I set a GUI.box` align point? 1 Answer

Texture quality and quality settings 1 Answer

How to make a button with rounded corners? 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