Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 sovan-k1 · Mar 15, 2016 at 02:20 PM · canvasrecttransform

Unable to make my UI independent of screen resolution

Hello Friends,

I am working in a project for mobile app and I am stuck at a point. I have to deploy that particular app in all possible mobile platform.

I am trying to fix the canvas scalar component but it does not help. The output in mobile and tab for android is different (same in iOS too). Also the UI elements changes the position with the device which is strictly not accepted. I am using pretty much the same UI elements like panels, images, buttons etc. I have gone through many tutorials and unity blogs but could not find things helpful according to my need.

Please help me and suggest some better way to solve the problem. I am posting this after my research and this is a genuine question. It will be a great help tome.

Thanks,

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 Ali-hatem · Mar 15, 2016 at 03:32 PM 0
Share

so have you changed the canvas scalar in the inspector to the Scale With Screen Size if so & didn't help then you have to do some coding to position or scale UI elements according to the screen size so it will be the same for all screen sizes example :

 public Transform button1;
 void Start()
 {
 buttton1.position = new Vector2(0,0);//lower left corner of the screen 
 }

  
avatar image sovan-k1 Ali-hatem · Mar 15, 2016 at 05:24 PM 0
Share

Yes I have changed the canvas to Scale With Screen Size. I don't understand the solution you gave me is very limited. What about panels and Background Image to fill the screen Completely. What shall i use then? And the image, panel button shall change size according to the device. I don't thing your solution is dynamic. Please correct me if I am wrong.

avatar image tanoshimi sovan-k1 · Mar 15, 2016 at 05:48 PM 0
Share

You really haven't provided much information, so it's kind of hard to help you. How have you anchored your elements? $$anonymous$$obile devices have different sized aspect ratios, so if you want to fill the screen you have to either let them reposition or let them stretch (or both) - these are controlled by the RectTransform component. Please post some screenshots of what you are seeing, and what you are trying to achieve, and also what settings you are currently using on your UI elements.

Show more comments

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by W4rf4c3 · Mar 15, 2016 at 08:49 PM

Are you using the anchors from the UI Gameobjects ? This will help to snap them in the same position whatever the resolution is.

alt text


untitled-1.jpg (74.3 kB)
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 Ali-hatem · Mar 16, 2016 at 10:08 AM 0
Share

caused bad result as i tested

avatar image
1

Answer by laharl219 · Mar 15, 2016 at 05:54 PM

Are you using anchors in your UI elements? It's really usefull (link about anchors http://docs.unity3d.com/Manual/HOWTO-UIMultiResolution.html)

You can also adjust resolutions via script. This might help you: http://answers.unity3d.com/questions/618058/mobile-device-screen-sizes.html

hope i could help you.

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
1

Answer by SaurabhStudio · Mar 15, 2016 at 06:30 PM

Hello @sovan.k1

as @laharl219 says, you have to place anchor properly and manually.

This video may help you.

https://www.youtube.com/watch?v=svyDgYz5idg

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

42 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 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

Find UI Image position in Screen Space 1 Answer

How to track a world object in a Screen Space - Camera Canvas 1 Answer

Efficiency & More: OnGUI() versus RectTransforms on a Canvas? 2 Answers

Can't get proper local point of rectangle for mouse click 2 Answers

My canvas recttransform.rect.height don't change properly 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