Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 /
  • Help Room /
avatar image
4
Question by zjinn · Aug 28, 2015 at 05:41 PM · canvasscale

Prefab does not scale in scale with screen size mode in UI

In unity 2d UI I have switched the canvas scaler into scale with screen size mode.

For those components added into the canvas manually the scaler works well. But for those added by scripts, even from the same prefab, the scaler does not work.

The appearance of the script-added component depends on the resolution setup, and mostly looks differently to those added manually, like following:

alt text

The first button is added manually and the rests are adde by scripts. I've set the button layout to be horizontally expanded so they should have fit the screen width but didn't. Anyone have ideas this could be a bug or did I set anything wrong?

屏幕快照-2015-08-29-上午13233.png (77.5 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
7

Answer by IgorSimovic · Feb 11, 2016 at 11:00 PM

I have same issue until i set

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

And now works fine

Comment
Add comment · Show 4 · 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 JadanBliss · Aug 01, 2017 at 12:55 PM 0
Share

Thank you! Why this isn't covered in the Shop UI tutorial, I'll never know. If I had any reputation points to reward you, they'd be yours.

avatar image Geads · Dec 10, 2017 at 10:19 PM 0
Share

This is still working as the answer in 2017. You are the real $$anonymous$$VP!

avatar image Abercromby3 · Feb 20, 2019 at 12:08 PM 0
Share

Thanks! Still the solution in 2018.3.

For any other noobs out there, implementation looked like this for me: resultObj.transform.SetParent(resultsPanel.transform, false);

Where resultObj was the object scaling incorrectly and resultsPanel was the parent is was being added to.

avatar image jerg33 · Mar 18, 2020 at 01:18 AM 0
Share

Thank you so much! Been trying to figure out a weird bug for like one hour. Thanks again!

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

32 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

Related Questions

Scale all things inside UI canvas 0 Answers

Unity 5 - Manually zooming/scaling in and out of an image with a text layer while still retaining text sharpness when zoomed? 0 Answers

problem with Canvas Scaler 1 Answer

How to get the new scale of world canvas resized by an emptyobject parent ? 0 Answers

RectTransform scale of my Canvas changed when I build on Android 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