Spawning Objects in Unity without the Clutter

George Asiedu
Oct 4, 2022

--

Previously using the Coroutine method we were able to get enemies spawning, this created a lot of gameobjects within our hierarchy.

to clean this up while are game is running we can make these gameobjects spawn within the spawn manager as a child and within a container.

This is a empty object created within the spawn manager. In the code we will let the spawn manager know it needs this to spawn enemies within it.

linking empty object by dragging and dropping the empty on to the field

we are instantiating game objects into this container now that we have access through this field

then we will want to access the new enemy then access the transform and get the parent to the assign it a new transform

this will make it a child to the enemy container

--

--

No responses yet