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 deanpackard · Dec 16, 2018 at 05:49 AM · uiprefabscaling

Prefabs for my UI look great in editor, but when played on android they are teeny tiny.

I've made a database management game in Unity and I'm releasing it on the google play store soon, but I'm stumped on a few prefabs not scaling properly. I have a few prefabs for things in the UI that will be a list. Like a list of games, or a list of players in those games. They need to be dynamic, and each needs to have a special action listener, so I used prefabs. These prefabs work perfectly other than not scaling right. In my Unity editor they fill the screen and look great, but when I run the game on an android emulator the prefab buttons become extremely tiny. I've tried attaching canvas scaling elements to them, and I set their anchors to the edge of the screen, but that doesn't seem to work. Do you guys have any tips for me figuring this out?

Edit: Added images, the first view is in the editor, the second view is from my android emulator alt text

alt text

in-editor.png (165.2 kB)
on-android.png (205.6 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 hexagonius · Dec 16, 2018 at 07:14 AM 0
Share

in the editor, in the game view, you can choose a resolution that simulates your phones resolution, even create new ones.
choose one that matches your phone and see if the ui still looks right in the editor.

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by deanpackard · Dec 16, 2018 at 04:57 PM

After continuing my research I found someone that had a similar issue many years ago, here is the answer post for that. https://answers.unity.com/questions/1037474/prefab-does-not-scale-in-scale-with-screen-size-mo.html To summarize this already short answer, where I'm instantiating my prefabs and setting their parent container like so

             go.transform.SetParent(this.transform);

I have to actually set an overloaded value, worldPositionStays, to false like so

             go.transform.SetParent(this.transform, false);

after doing this my UI works perfectly. World position stays, when true, makes it so when your parent container changes, your prefab remains the same, which we don't want. so just set that to false and WALAH!

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 CentauriDev · Dec 16, 2018 at 08:32 AM

Have you set the canvas to scale with screen size?

This scales the ui elements with the screen

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 deanpackard · Dec 16, 2018 at 04:32 PM 0
Share

Yes, I have done this. I have them in a scroll view and vertical layout group. I think the issue is in there. Here are screenshots of the settings in the layout group and for the prefab alt text

alt text

scorelist.png (49.7 kB)
prefab.png (41.1 kB)
avatar image deanpackard · Dec 16, 2018 at 04:45 PM 0
Share

It is strange, because when I set the canvas to scale with the screensize, everything did except my prefabs

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

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

GridLayout Scaling Issues 1 Answer

Multiplayer UI scaling 0 Answers

Scale UI with distance 1 Answer

How to I scale UI 9-slicing across different resolutions? 2 Answers

Associate UI with gameobject 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