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 Giannis7312777 · Jul 22, 2013 at 09:11 AM · guiscreenadjustresizable

Adjust GUI in all Screens??????

Hello everyone, is there any way to adjust my GUI box in all screens? I mean when I change my resolution the box disappears.... please help me.

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 CHPedersen · Jul 22, 2013 at 09:37 AM 1
Share

Please provide more information describing your exact problem. Is it a box you scripted yourself, eg. GUI.Box? If so, what Rect are you passing it? Are you using absolute coordinates for it, or calculating them based on the screen?

avatar image Giannis7312777 · Jul 22, 2013 at 11:56 AM 0
Share

$$anonymous$$y box is like that: GUI.Box(new Rect(Screen.width 0.5 , Screen.height 0.965, healthBarLength, 20), "");

1 Reply

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

Answer by Briksins · Jul 22, 2013 at 09:38 AM

Just use Screen.width and Screen.height to define your box borders, that way box will be dynamically resided for various screens sizes for various platforms

 //BOX SIZE DECLARATION

 int width = <width_of_box>;
    //if you want it to be full screen width then = Screen.width

 int height = <height_of_box>;
    //if you want it to be full screen height then = Screen.height

 //POSITIONING BOX IN THE MIDDLE OF THE SCREEN
 int x = Screen.width / 2 - width / 2;
 int y = Screen.height / 2 - height / 2;
 
 //GUI BOX DEFINITION
 GUILayout.BeginArea(new Rect(x, y, width, height));
    GUILayout.FlexibleSpace();
       //***
       GUILayout.Lable("Hello im GUI Lable");
       //***
    GUILayout.FlexibleSpace();
 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 Giannis7312777 · Jul 22, 2013 at 11:48 AM 0
Share

Thanks so much for the reply. How will be the health bar? I dont want it to be on the middle of the screen. I want it something like bottom-left or bottom right, or bottom-middle.

Thanks again :)

avatar image Briksins · Jul 22, 2013 at 12:19 PM 0
Share

well it is your business to make decision where you want this box to be in the left or right and apply calculation logic in next 2 lines after this: //POSITIONING BOX IN THE $$anonymous$$IDDLE OF THE SCREEN

I just showed you an example how to use dynamic calculation of screens with different sizes

P.S. Also would be nice if you mark my answer as accepted if you happy with it, as it is good way to thanks people who helping you

avatar image Giannis7312777 · Jul 22, 2013 at 01:41 PM 0
Share

Thanks :)

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

17 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 avatar image avatar image avatar image

Related Questions

Resizable GUI box how to? 1 Answer

Adjusting GUI 1 Answer

showing variables 1 Answer

know GUILayout current screen position 2 Answers

Application LoadLevel on Input.KeydownEnter TextField 0 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