|
I'm trying to be able to instantiate a game object from the script attached to a different object, so i could later destroy them one by one. How do i keep track of number of objects and how do i access a single object to be destroyed? Do i need to make my object a prefab? Do i need to use an array for this (i need a max of 6 objects)? I think i can't use a script in the object to clone, because the cloning would be made from gui menu, so every clone of my object would also create a cloned menu on top of the previous one. This is just too complicated for me.
(comments are locked)
|
|
This got me the idea how to proceed. Thank you very much.
(comments are locked)
|
|
You can make a list of GameObject and when they're instantiated (Instantiate a prefab) you add them to the list. To destroy the objects you can use a loop inside a coroutine, like: Make sure to call the method with StartCoroutine just one time. You can make the list of Game Objects a static list so you can add in to this list from any other script.
(comments are locked)
|
