- Home /
How can i modify the hirarchy of a game object
The point is this: I have a large number of Spheres and Extern Objects and now i want to change the extern objects into children of a sphere ^^ i want to do this because i want the extern object to be "in" the sphere and if you click on the sphere the sphere becomes disabled. also i want to randomly hide the objects under random spheres
to say it in a few words: it should be a memory game with pokemon figures
(by the way i want to do it with C# ^^)
Answer by whydoidoit · Mar 08, 2013 at 05:18 PM
You can change the hierarchy by setting the .parent property of the child's Transform to the new parent:
child.transform.parent = newOwner.transform;
Note nothing will move when you do this, but scaled parents can have an unusual effect on their children.
so this way is the same like drag/dropping the object in the sphere? (in the hirarchy tab)
... i hope you know what i mean :)
Your answer
![](https://koobas.hobune.stream/wayback/20220613094046im_/https://answers.unity.com/themes/thub/images/avi.jpg)