Spawning Objects Into Unity Without The Clutter

When you instantiate a game object into a scene within unity it will appear as a new object within the hierarchy. This can prove to be annoying as new objects continue to spawn and clutter up the window…

So what should I do?

It’s easy! The simplest way to go about correcting this is to create an empty game object in the hierarchy and use it as a storage container from which to assign all newly instantiated objects as children. The code below shows how to implement this.

[NOTE]

You will need to drag and drop the prefab you are wanting to spawn into the game object reference “_enemy” within the hierarchy. The empty game object that will be used as a storage container will need to be referenced as well. Drag and drop that object into the game object reference _enemyContainer within the hierarchy.

--

--

--

Hi, my name is Adam Reed and I am a software engineer specializing in Unity and C# development. Feel free to scroll through and check out some of my work!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Time Complexities By Insertion Sort , Merge Sort And Quick Sorts

The Myers Diff Algorithm and Kotlin Observable Properties

If you ever used subway you should know what Binary Search Tree is

Privilege escalation through insecure configuration.

AssetSonar Listed Among The Best License Management Software Companies Of 2021 By Digital.com

AssetSonar Listed Among The Best License Management Software Companies Of 2021 By Digital.com

Contributing to MMLib.SwaggerForOcelot library for gateway itself documentation

Selling (or buying) CI/CD

The cite HTML Tag

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
Adam Reed

Adam Reed

Hi, my name is Adam Reed and I am a software engineer specializing in Unity and C# development. Feel free to scroll through and check out some of my work!

More from Medium

Creating An Advanced 2D Player Controller Without Any Unity Components! (Part 3)

Mastering Unity Scripting | Summary — Chapter 2: Debugging

Attack while jumping

Overloading methods in C# & Unity