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 IvayloDev · May 19, 2016 at 08:44 AM · uiscreensizeratio

Making objects be at size and place for every phone size

I want to ask if making all your object UI elements is a bad practise. Im currently animating a object but because its UI it lags and jitters, but if its in the scene it works great. I've got used to making all object UI, because that way I can set the anchors and it look good and every phone size because everything is sized propery. So my question is, how to make all my objects be in the scene(not UI) and be at the same position and size no matter the screen size, just like if they were UI elements.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by akisrn · May 19, 2016 at 02:18 PM

This tutorial pretty much covers everything. Check it out.

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

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 IvayloDev · May 19, 2016 at 02:30 PM 0
Share

As I said in the question, I don't have problem with the UI, its the objects that are in the scene and that they are at different places for every phone.

avatar image
0

Answer by coolraiman · May 19, 2016 at 02:16 PM

there is a lot of way to do that

some people just make a root parent and scale it to the screen ratio of the phone. by example your screen is made in a 16:9 ratio but the phone screen is 4:3, you divide by the denominator so you go from 16:9 to 5.3:3 and then scale everything in % based on that

then if all child use relative position, everything should work fine

this may look dirty on some phone. but in general its not that bad

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 IvayloDev · May 19, 2016 at 02:28 PM 0
Share

Do all people who develop for mobile do that ? Isn't there a easier option ?

avatar image NoseKills IvayloDev · May 19, 2016 at 05:41 PM 2
Share

Definitely not all. I've never done that. Completely depends what kind of a result you want.

There's hundreds of questions about "how to make a game look the same on all phones" on Unity Answers and the simple answer is "you can't". If 2 devices have different aspect ratios, all you can do is compromise in different ways.

Then again for example Unity's camera implementation already automatically scales everything no matter what the resolution. An orthographic camera with size 5 always shows exactly 10 world units from top to bottom. If you want your game to always show the same amount of the world height wise, then your game would "look the same on all phones" without any additional coding.

To me the idea of using ui anchors for game logic feels weird because it could easily lead into situations where the game plays different on different screens. If you anchor something to the bottom corners of the screen, then they will be farther apart on wider screens.

The gameplay and how you present it to the player are two different things. You shouldn't compromise the former because of the latter :)

avatar image coolraiman IvayloDev · May 19, 2016 at 06:26 PM 0
Share

sorry to tell you ivayloDev that scaling the root parent is the most lazy and simple fix

its not bad in general but as nosekills said, there is no perfect way to do it

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

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

Scaling game to fit screen size 2 Answers

Unity 5 UI Fill Any Screen 2 Answers

Draw texture the same size of a sprite 1 Answer

Input.mousePosition.x is greater than Screen.width ... huh? Anyone know why? 1 Answer

ShowAchievementsUI screen rotation 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