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 Jamie_h88 · Oct 23, 2013 at 04:19 PM · gui-problem

GUI Screen Size

I am having real trouble with this. I want to keep the GUI text in a particular part of the screen no matter what res or screen size. At the moment every time I change PC from home to uni etc the position of the text changes. I am attempting to do thing in a 16:9 aspect ratio.

Hope someone can help??

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 robertbu · Oct 23, 2013 at 04:52 PM 0
Share

How is this 'particular part of the screen' defined? Are you talking about a GUIText game object or the GUI system (GUI.Label())?

1 Reply

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

Answer by zombience · Oct 23, 2013 at 04:52 PM

When assigning GUIText or GUITextures to on-screen positions, use the Transform's properties (i.e. the X and Y coordinates) to position the texture on screen. These will always be screen-relative.

If you are using the pixelInset to place the textures on screen, you're going to have a bad time, since those will move according to the pixel width of your screen.

For example. you could use a pixel inset of 100 pixels from the right of the screen to place your GUITexture. On your 1920 x 1080 monitor (16:9), the pixel inset will be exactly where you want it. Then, when you bring up the project on your 1280 x 720 (also 16:9) screen, your pixel offset will still be 100, but will appear to be further in since you now have less pixels to work with on screen.

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 zombience · Oct 23, 2013 at 04:56 PM 1
Share

also, I currently wrote a custom editor to deal with exactly this scenario, so that I can avoid using Unity's GUI system entirely. I just work with GUITextures and GUIText as if they were normal game objects that scale relative to screen size in the editor and in gameplay. I've had this problem often enough that it drove me to drink... er, i mean.. fix the problem

After I'm through with the current project, if I get some time I'll put up a package on the Asset store.

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

15 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

Related Questions

can i find Joystick Position based on screen size? 0 Answers

GUI crashes in Android 4.1 0 Answers

Display text on each side of cube 0 Answers

[solved] Problem getting data from array 0 Answers

Is there way to apply scale on guitext? 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