Colliders on instantiated gameobjects

Hi guys,

I'm spawning a couple trees ramdomly on a map but I would like delete them in case they spawned on top of each other but my colliders don't seem to be working right. What's the right way of checking if a tree is colliding with another one when spawning it?

This is my spawner code:

This is the script I tried to use in each tree to check for collision:

Thanks guys!

void OnTriggerEnter(Collider other)

"other" is the the other object that has collided with this object. All you need is a way of identifying whether this "other" object is a tree GameObject.
You can do this however way you wish, usually it's done by comparing the name or tag.

For example:

void OnTriggerEnter(Collider other) {
   if(other.gameObject.CompareTag("tree")) {
      //A collision with a tree object has been detected.