I have a scripted object that instantiates objects from an array when it collides with something. That part working with this:
GameObject biasBar; public int barNumber;
private void OnTriggerEnter2D(Collider2D other)
if(other.tag == “Object1”)
Instantiate(bar[barNumber++], new Vector3(6, -4, 0), Quaternion.identity);
if(other.tag == “Object2”)
Instantiate(bar[barNumber–], new Vector3(6, -4, 0), Quaternion.identity);
The problem is that I only want to have one object from the array on the screen at a time. Is there a way can I delete the current array object once the new array object is instantiated?