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 TheMagicalAxolotl · Apr 16, 2014 at 02:18 PM · unity 2dgui-problem

GUI object misalignment, Why is this happening?

So I've just started working with the 2D part of unity and I'm trying to get a gui object to fit in the bottom left corner of the screen but when it appears to fit in the editor and I build and run it to check it doesn't fit. I'm not sure why this is happening and I've been trying to figure it out on my own for a week now.

alt text

alt text

If anyone knows why this is happening and how to fix this it'd be wonderful if I could get some help on it.

unity screenshot 1.png (88.8 kB)
unity screenshot 2.png (128.4 kB)
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 NickP_2 · Apr 16, 2014 at 02:28 PM 0
Share

Could you upload a pic of the gui element's inspector view?

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by NickP_2 · Apr 16, 2014 at 02:34 PM

GUITextures are tricky to place, they have 2 methods of positioning; transfer and pixelInset.

If you set all the values to 0 in pixelInset, you can control the GUITexute completely on screensize with the transform values, so it doesn't matter what size of screen or resolution, the GUITexture will always have the same size or position compared to the size/resolution. For example: when the texture is half the screen on 400*800, it will also be half of the screen on 1600*900.

If you work with pixelInset, the position is absolute in pixels, so when you enter position x = 400 and y = 0, it will change position in other screen sizes. same with size.

Maybe you got confused with these? I'm very bad at explaining so here's unity's explanation: **HERE**

Hope it helped

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 Owen-Reynolds · Apr 16, 2014 at 02:51 PM

That little thing is a GUITexture, the one currently with default name UnityWatermark-small?

Zero-out everything below pixelInset. Instead, adjust the Transform scale and position. Position is the center, and scale is % of the screen. For example scale=(1, 0.1) and position = (0.5, 0.05) will make a long bar over the bottom 10% of the screen. To put in a corner, position should be 1/2 of the scale.

The pixel stuff, IMHO, is for those very rare times when you can count pixels (like it will only ever run on a 1280x960 screen) and feel like you want to.

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

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

Related Questions

Play sound once on collision 1 Answer

Laser beam using particle system Unity2d. 0 Answers

Vector3.MoveTowards doesnt work 1 Answer

Does someone know how to simply invert mouse movement? 2 Answers

Instantiated object not showing in scene or hierarchy 2 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