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 · Dec 12, 2014 at 01:08 AM · editorparentchildchild-to-gameobject

Why gameObj's pos changes when a child is added ?

http://prntscr.com/5ftxwq -1st screenshot

http://prntscr.com/5ftz66 -2nd screenshot

http://prntscr.com/5ftzhq -3rd screenshot

http://prntscr.com/5fu5ls -4th screenshot

http://prntscr.com/5fu6cw -5th screenshot

GameObject's position is 000 all the time but when a child being added to it, it changes its position somehow as if it was the child not the parent and it's 000 pos becomes in the center of the PlatformLongest gameObject not in the center of the screen. To see this you can just switch fast between the 1st and the 3rd screenshot.

Also when I add another gameObj to the parent (PlatformShort in this case) the parent gameObj's position goes between the 2 children positiion. You can see this by switching between the 4th and the 5th screenshot.

Please if anybody can help me.. it doesn't look like something very buggy just probably I don't understand how it works.

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
1
Best Answer

Answer by EvilTak · Dec 12, 2014 at 01:26 AM

GameObject is an empty game object. Since it has only one child, it's position will be the center of that child. If it has two or more children, a bounds encapsulating all of them is created, and the position of the parent object will be the center of that bounds.

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 MapuHoB · Dec 12, 2014 at 01:31 AM 0
Share

Thanks! Does this work like this any time without exceptions ?

avatar image EvilTak · Dec 12, 2014 at 01:32 AM 0
Share

Yes it works every time. You can try it and see.

avatar image EvilTak · Dec 12, 2014 at 01:34 AM 0
Share

If the parent has any collider, mesh, etc. The bounds will take that into account too.

avatar image
2

Answer by Owen-Reynolds · Dec 12, 2014 at 04:46 AM

The actual position isn't changing. You can even see that it's always (0,0,0) in the Inspector. The editor is just trying to be helpful by moving the handles to the center of the object, just to make it easier to find.

See the small button in the upperish left that says "Center", next to "Local"? If you click it to "Pivot" the handles will stay at the actual position. Of course, it has no effect on game play.

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

27 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

Related Questions

Make a simple tree 1 Answer

Child selection forces parent selection 1 Answer

Why is parenting not working? 0 Answers

Get Child from a parent 3 Answers

Destroying of parent causes issues for OnDestroy() in children 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