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 TheEliteGameGuy · Oct 29, 2014 at 01:40 AM · c#gui

How to posistion GUI elements?

The problem I am having is the time bar is interfering with the max players bar http://prntscr.com/50kgq5 Here is part of the script

 GUILayout.BeginHorizontal();
 GUILayout.Label("Max Players: ", GUILayout.Width(130));
 // Select Round Duration Time
 GUILayout.Space(5);
 GUILayout.BeginHorizontal();
 GUILayout.Label("Time", GUILayout.Width(130));
 for(int i = 0; i < maxTimeOptions.Count; i++){
 if(roundDuration == maxTimeOptions[i]){
 //Selected number is green
 GUI.color = Color.green;
 }else{
 GUI.color = Color.white;
 }
 if(GUILayout.Button(maxTimeOptions[i].ToString(), GUILayout.Width(45), GUILayout.Height(28))){
 roundDuration = maxTimeOptions[i];
 }
 }
 GUI.color = Color.white;
 GUILayout.EndHorizontal();
 for(int i = 0; i < maxPlayersOptions.Count; i++){
 if(maxPlayers == maxPlayersOptions[i]){
 //Selected number is green
 GUI.color = Color.green;
 }else{
 GUI.color = Color.white;
 }
 if(GUILayout.Button(maxPlayersOptions[i].ToString(), GUILayout.Width(27), GUILayout.Height(25))){
 maxPlayers = maxPlayersOptions[i];
 }
 }
 GUI.color = Color.white;
 GUILayout.EndHorizontal();
  
  

Please help me fix this

Comment
Add comment · Show 2
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 Cherno · Oct 29, 2014 at 01:47 AM 0
Share

How is the time bar interfering with the max players bar? Where should it be placed ins$$anonymous$$d? Does that dark rectangle near the center have any significance? Please provide some more info :)

avatar image TheEliteGameGuy · Oct 29, 2014 at 02:03 AM 0
Share

The time is ment to be bellow the max players. The dark rectangle is just a demo, when it's finished it will ba a pictur of a map

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Teal · Oct 29, 2014 at 05:06 AM

Change

 GUILayout.Label("Max Players: ", GUILayout.Width(130));

to this

 GUI.Label(new Rect(From Left, From Top, Width, Height), "Text");

Here is the script for it, Look on the unity website more, it is really helpful

P.s. May be a bit harder at the beginning due to scaling, but with a bit of practice GUI can be made simple

Have fun

Comment
Add comment · Show 1 · 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 TheEliteGameGuy · Oct 29, 2014 at 12:30 PM 0
Share

I'm actually not too bad with GUI, but I'm use to JS and a friend of $$anonymous$$e is looking me to fix a script in C# which is why I'm having a bit of bother

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Multiple Cars not working 1 Answer

Trying to Highlight text in order to copy and paste, but do not want the text to be editable. 1 Answer

Can EditorWindows dynamically display interfaces of other Editor Windows ? 1 Answer

How can i make a local high score system with C#? 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