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 AceDawg45 · May 12, 2015 at 10:08 AM · uiunity5canvas

Having a bit of trouble with Unity5's canvas

I am attempting to make a UI with the canvas, and it looks great, except I went to build the project and run it for testing, and all of the canvas objects are... out of whack - meaning: misplaced, noticeably off center, etc..

Under "Canvas", I have Render Mode set to Screen Space - Overlay

Under "Canvas Scaler": Scale with screen size, match width or height.

I don't really know what they do, I read up in the Unity docs but I didn't really comprehend it well. Anyone have experience with the canvases?

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Eudaimonium · May 12, 2015 at 01:08 PM

You probably didn't correctly set all the element's anchor points.

Best way to get all the elements to be roughly the same size/position on various screen resolutions is simply to outline them with anchor points, as shown here:

alt text

Notice the small white triangles behind the blue rect control handles - just make the anchor rectangle closely fit the element's outline and you should be good to go in most cases.

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 AceDawg45 · May 12, 2015 at 10:08 PM 0
Share

Can you explain a little on how anchors work please? I am still a little confused

avatar image AceDawg45 · May 12, 2015 at 10:27 PM 0
Share

Oh, I got it! It took me a bit to figure out what you were trying to say.

avatar image Eudaimonium · May 13, 2015 at 08:46 AM 0
Share

The anchor is a rectangle that is always a fixed size on canvas - notice how when you're resizing the anchor, the values are written in a percentage of the screen size?

The element's size is the finally calculated from the anchor - the element's border is always the exact same distance to the corresponding anchor border.

That's about as best as I can roughly explain it, you have more info here: http://docs.unity3d.com/$$anonymous$$anual/HOWTO-UI$$anonymous$$ultiResolution.html

Basically, it just boils down to outlining the elements with their anchors, if you want to keep the elements the constant size across screen sizes. You can always experiment, seperate your game window from main Unity window, and as you resize that, you will notice your canvas and everything resizing along with it, and you can see in real time how it all behaves.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Set Native Size in UI 1 Answer

How to attach a (that world type) canvas to a moving player? 0 Answers

Scrollview Without Canvas 1 Answer

Unity 5 GUI Buttons Won't Show When Built 0 Answers

Unity 5 and Pixel-Perfect in the Canvas 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