Spawning Objects in Unity without the Clutter
Objective: Learn how to spawn objects without cluttering our hierarchy.
When we have for example a Coroutine, constantly spawning new enemies in our game, you can see that our Hierarchy starts to get clutter, as more objects are spawned.

In order to prevent this, we can create an empty GameObject, which is going to hold all new enemies being created, and assign it as their parent object.
There are two ways we can do this:
GameObject newEnemy = Instantiate(prefab, position, Quaternion.identity);
newEnemy.transform.parent = container.transform;
In the example above, when we instantiate a new enemy (prefab), we are assigning it to a new variable of type GameObject. Afterwards, all we are doing is assigning a new parent to our new enemy.
Instantiate(prefab, position, Quaternion.identity, container);
Now the simpler version of this is simply assigning the parent on one of the overloads we have for the Instantiate method. This way, the object being instantiated has its parent assigned for our container directly.

Now that we’ve done this, we can Collapse our container in our Hierarchy, allowing to see all objects that it parents, or just closing said view and making clearer to our Hierarchy as a whole.