Objective: When instantiating, assign gameobject into a parent object for a less cluttered project. Also how do you adjust a instantiated object.
Let’s reduce the clutter. To do this, we need to create a enemy container object under our spawn manager. Then when we instantiate an object, we need to make that instantiated object a child of another object in our hierarchy.
To do this, let’s first define our game object. We can either serialize it or use a find method:
Then under our instantiate code, let’s set the position of our instantiated object. In order to do this, we need to make sure we declare our object that we instantiated as an object that can be reachable. After that, we can easily adjust the clone’s parent attribute position. We can also add a Destroy function to kill each clone after a certain point of time.
Now each instantiated object can be manipulated as well.