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 xtplpune · Apr 18, 2012 at 11:10 AM · guipositionzoomlayout

GUI button adjustments

hi to all....

am facing a rare problem,it is very silly to see....but try to help me !

i created 5 buttons . it is exactly visible when the browser ( chrome,opera,IE,Mozilla ..etc) when browser zoom is 100 %. but when i change the browser zoom (90%,80%,150%.....etc),the gui buttons are not visible on the screen.

i want those GUI buttons always at a particular position,even if i change the browser zoom.

please help me !!!

Comment
Add comment · Show 4
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 Lttldude · Apr 18, 2012 at 11:31 AM 1
Share

are the GUIButtons based on the screen width or are they fixed positions. Could you post a snippet of code of the buttons?

avatar image xtplpune · Apr 19, 2012 at 05:59 AM 0
Share

all are in fixed position.

avatar image syclamoth · Apr 19, 2012 at 06:01 AM 0
Share

Well then that's your problem! You need to define all your positions in terms of Screen.width and Screen.height- this will guarantee that all your buttons retain a sensible scale on the viewport.

avatar image xtplpune · Apr 19, 2012 at 10:43 AM 0
Share

thank you.....

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Lttldude · Apr 19, 2012 at 06:06 AM

Here is an example of making GUI elements relative to the screen size:

 function OnGUI()
 {
     var sW = Screen.width;
     var sH = Screen.height;
 
     GUI.Box (Rect (0,0,150,30), "Top Left Corner");
     GUI.Box (Rect (sW-150,0,150,30), "Top Right Corner");
     GUI.Box (Rect (sW-150,sH-30,150,30), "Bottom Right Corner");
     GUI.Box (Rect (0,sH-30,150,30), "Bottom Left Corner");
 }

Hope it helps, be sure to ask if you still have issues.

Comment
Add comment · 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
0

Answer by xtplpune · Apr 19, 2012 at 03:19 PM

thank you....almost it is working....

Comment
Add comment · 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

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

6 People are following this question.

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

Related Questions

zoom problem with GUI Box that follows a character 1 Answer

know GUILayout current screen position 2 Answers

Unity2D - Camera in exported game is zoomed out compared to unity game preview HELP PLEASE! 2 Answers

GUI Layout problem 1 Answer

Why is my GUI pushed over to the right? 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