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 MapuHoB · May 18, 2015 at 04:15 AM · gameobjectscale

GameObject's scale gets 0 after being parented in editor

alt text alt text

1) Before

2) After being parented.

Update1: Okay so I found a pattern. When adding the child, if the parent's scale.z = 0 the child scale.xyz becomes 0 on parenting. If the parent's scale.z != 0 it works. Another experiment that I tried was, after successfully adding the child(without getting scaled down to 0) and then to make the parent's scale.z = 0, the children's scales don't get affected at all.

Why?

Comment
Add comment · Show 2
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 Owen-Reynolds · May 18, 2015 at 03:46 PM 0
Share

So, you solved it. Don't have any parent scale be zero. In general, I can't think of a reason to ever have a scale set to zero. Usually the parents are kept as (1,1,1) empties.

Not sure if this is a bug -- I think it's just how the math works out, for children.

avatar image FortisVenaliter · May 18, 2015 at 06:04 PM 0
Share

Yeah, there are always problems, in my experience, with parenting an object to a non-uniform scale transform. Try to avoid it at all costs.

1 Reply

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

Answer by MapuHoB · May 19, 2015 at 07:14 AM

When you change an object's parent in Unity, the editor automatically adjusts the object's local position/rotation/scale values so that the global appearance stays the same (or as close as possible)

So for instance, if I take an object with scale (1, 1, 1), and add it to a parent with scale (2, 2, 2), Unity will adjust the child's scale to (0.5, 0.5, 0.5) so that the net result of its transform hierarchy is the same (1, 1, 1) it started with.

Unfortunately, there are a few cases where this breaks down, and Unity can't maintain the object's global appearance. One such case is if any of the parent's scale axes are zero. Trying to compensate for a zero scale results in a division by zero, so there's no right answer.

It looks like in this case, Unity sets the scale of the object to zero as a fallback.

The best way to avoid this complication is to not use non-uniform scaling on parent objects. Uniformly scaled transforms are easy to nest & re-parent without loss or distortion.

Source

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

19 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

Related Questions

Game Object Scaling based on Proximity 1 Answer

How to get an object to fill 3/4th of the screen. 0 Answers

Match a GameObject's size to another's? 2 Answers

Make gameobject size always be the same 3 Answers

Game Object scale jumps when animation plays 0 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