Hi, for my little I'm-learnign-Unity project I created a bunch of different colored spheres which I instantiate at runtime. As I create lots of those, the hierachy view gets immediately flooded with all the new spheres. So basically I search for a way to group all of the new spheres into one root/parent object. If I understood the manual right, I needed to create an empty game object container which I did, but how can I now make this new gameobject the parent of the prefabs when I instantiate them from code? I tried searching for "parent" and "root", but didn't find appropriate stuff (or overlooked it Thanks for any help. Martin
What you're looking for is to set yourInstantiatedObject.transform.parent to the transform of your empty holder object.
Ah, great, thanks. Can this be "baked" in already for the prefab or do I need to assign this when instantiating the prefab?
Works super. This is how I did it: I created an empty GameObject called "BallContainer". Then I created an instance of the sphere by this line: clone = Instantiate(prefab1, pos, Random.rotation); and then fetched the BallContainer object: var groupParent : GameObject = GameObject.Find("BallContainer"); and now the magic - parent the instanced sphere: clone.transform.parent = groupParent.transform; That's all. All new spheres are created as childs of the game object.