Spawning without making a mess

Anything you instantiate will show up in the hierarchy. The hierarchy will quickly fill up and become unmanageable. Luckily, it is easy to tidy it up by childing objects to another object:

This is a little bit down to preference, but I like to have one parent per object type i.e “Projectiles” or “Enemies”:

Open up one of the scripts in which you instantiate and add a Transform. Ensure that it is serialized so that you can add the game object from the inspector:

Add a local GameObject to store a reference to the object that got instantiated. Then on that instantiated object set the parent to the Transform you just added. Repeat these steps for each script with Instantiate in:

Add the parent game object to the script:

Final result:

Good luck!



Unity / C# Game developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store