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 HussamI · Mar 13, 2015 at 11:25 AM · 2duiunity 4.6anchor

[4.6 2D] Making UI image stick to the side

Hello, I have a simple scene, in it is a simple initial design of having a sidebar with some options(Mute music, mute effects, main menu) on it, but I'm facing a problem when placing it to the side, I try and place the anchors(I frankly don't know much on how they work, but I followed some tips I read and so far they work), everything looks fine in the editor view, but in the game view when maximizing the sidebar moves a bit to the center, making it floating instead of sticking to the side.

Pictures:

1) how I want it to be(Edit view): edit view

2) How it looks in the game view when maximized or it has a high enough resolution: Game view

You can notice it slightly floating to the left, now that might be minor, but it irritates me, it's an initial design with nothing final, but I would like to solve the problem with your generous help, simply knowing how to make it snap to the sides if that's the appropriate word for what I want to do.

Thank you.

edit.png (21.1 kB)
game.png (20.3 kB)
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
1
Best Answer

Answer by fffMalzbier · Mar 13, 2015 at 11:29 AM

You can set your anchor to middle right. That should all ways have a fixed position to the vertical middle on the right side. Setting the pivot of you element to 1 could help too. I can recommend the UI Rect Transform Tutorial for good overview over the Anchor. http://unity3d.com/learn/tutorials/modules/beginner/ui/rect-transform

Comment
Add comment · Show 2 · 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 HussamI · Mar 13, 2015 at 08:25 PM 0
Share

Thank you, that works in keeping the image stuck to the side, but it makes the image small in comparison to the resolution when it increases, that's why I stretched the anchors around the image borders, so that it maintains the size at all resolutions. Is there a way I can anchor it to middle right while still having the size adjustable?

Thank you very very much for the answer!

avatar image fffMalzbier · Mar 14, 2015 at 03:07 PM 0
Share

If you like your whole gui scale to the different resolutions you should take a look at the "Canvas Scaler" component on your canvas. You can set it to "Scale with Screen Size".

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

UI 4.6: custom anchors breaking sizeDelta 0 Answers

Unity4.6 : No scaling UI, Content vanishes in a smaller viewport 1 Answer

Scoring System Unity 6.4 C# 2D Game 1 Answer

Unity 4.6 2D,UI apears under game Sprite 1 Answer

Instantiating into UI objects 1 Answer


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