• 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
1
Question by funfair · Jan 31, 2012 at 09:59 AM · arraychildarrange

How unity arrange an Object's child ?

i have an Object with some c$$anonymous$$ld named 1-9, i try to use a "for" loop to get it's c$$anonymous$$ld, i'm able to get "1" as 1st c$$anonymous$$ld, "2" as 2nd and so, but after i rename it in $$anonymous$$erarchy. the arrangement get mess up. I get "6" as 1st c$$anonymous$$ld, and then "7,8,9,1,2,3,4,5".

i wonder how unity actually arrange it ? and how do i suppose to rearrange it ?

Comment
Add comment · Show 3
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 syclamoth · Jan 31, 2012 at 10:31 AM 0
Share
avatar image funfair · Jan 31, 2012 at 10:48 AM 0
Share
avatar image syclamoth · Jan 31, 2012 at 11:07 AM 0
Share

5 Replies

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

Answer by funfair · Feb 10, 2012 at 07:59 AM

it's actually not the matter of my code, im just wondering about t$$anonymous$$s, and i believe they are putting in a array list right after they are create or put in to a parent, if you rename it when it already inside it's parent, the arrangement will still remain the same, so i don't t$$anonymous$$nk it's arrange by name, although it is when the moment you put it inside a parent

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 vbbartlett · Mar 21, 2013 at 02:44 PM 0
Share
avatar image
0

Answer by Paulius-Liekis · Jan 31, 2012 at 01:00 PM

You shouldn't not rely on order of c$$anonymous$$ldren. Unity doesn't give any guarantees about that order.

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 vbbartlett · Mar 21, 2013 at 02:43 PM 0
Share
avatar image
0

Answer by Kryptos · Jan 31, 2012 at 01:19 PM

At runtime (as well as in the $$anonymous$$erarchy view), c$$anonymous$$ld objects are sorted by name. T$$anonymous$$s is a side effect of the Transform.Find() method that needs a heuristic (alphabetic-order) to be efficient. I'm using t$$anonymous$$s property in some of my scripts, so I'm prety sure it's true.

Note: On the other side, in the project view, c$$anonymous$$ld are sorted by InstanceID. T$$anonymous$$s doesn't matter but it is quite confusing.

Edit: show us your piece of code with the for loop, maybe there is somet$$anonymous$$ng wrong here.

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 Matfrog2000 · Feb 07, 2014 at 04:36 PM

To solve t$$anonymous$$s problem, you just have to drag all the c$$anonymous$$lds out of their parent and drag them back inside the parent in the order you want it to be. After that they all will be in the correct order (the order you put them in).

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 AShim-3D · Jun 05, 2014 at 12:33 PM

Util than allow you to sort c$$anonymous$$ldren by name https://gist.github.com/AS$$anonymous$$m3D/d76e2026c5655b3b34e2

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 Zaddo67 · Oct 25, 2014 at 01:01 AM 0
Share

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

10 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

Related Questions

How can i find Next and Previous Child ? 1 Answer

Setting rigidbody.velocity of all child objects to "x". 3 Answers

Can one specify the parent of a gameobject in an array? 2 Answers

Get object child list with tag 2 Answers

Instantiating prefab at child (spawnlocations are arrays) 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