In a script, how do I make something happen to the clones of the object and only the clones of the object.
For example if I wanted to destroy all the clones of the object and not the original game object, how would I do that? Thanks
When you instantiate an object (clone) it will also return the gameobject that you can store as a variable.
public GameObject Original;
private List<GameObject> _clones = new List<GameObject>();
public void Start()
{
for (int i=0; i < 10; i++)
{
var clone = Instantiate(Original, new Vector3(0,0,0), Quaternion.identity);
_clones.Add(clone);
}
// When you're done with them destroy all the clones
foreach (var cloneObj in _clones)
Destroy(cloneObj);
_clones.Clear();
}