Don't know how to use OnTriggerEnter instead of OnCollisionEnter

Just gonna get straight to the point as I assume its a simple answer I just can’t work out.
I have this script which i’m currently using:

private void OnCollisionEnter(Collision collisioninfo)
    {
        if (collisioninfo.collider.tag == "Obstacle")
        {
            Destroy(gameObject);
        }
        if(collisioninfo.collider.tag == "Destroyer")
        {
            Destroy(gameObject);
        }

Lets say the Script is ScriptA and the obstacle is testobject1
ScriptA is on testobject

The problem I have is that sometimes the destroyer (the object in which the testobject1 touches to cause it to destroy) can get catch on the testobject1 its trying to clear. So I wanted to convert the destroyer to a trigger so that it doesn’t have the collider on it, however what I’ve tried does’t work. I need it to be able to destroy a whole variety of objects for example testobject2, testobject3 and testobject4, when it goes in the box collider’s area. so a script which could go on the destroyer would be ideal if that is possible, but if it has to be each individual object, that works to. Thank you for any help you can give me, not matter how small. Even if its just a point in the right direction.

Did you take a look at the OnTriggerEnter api?

Make sure to read the notes as well as they contain important information, but it should be fairly straight forward as it’s pretty similar to the OnCollisionEnter.

Thanks for trying to, I found this code at the bottom to destroy anything that enters the trigger:

using UnityEngine;

public class Example : MonoBehaviour
{
   // Destroy everything that enters the trigger
   void OnTriggerEnter(Collider other)
   {
       Destroy(other.gameObject);
   }
}

However nothing happens, can you give me any help?

EDIT: I Feel really stupid, I forgot to tick the box for the box collider…
I guess you learn from your mistakes

And did you setup everything correctly? There isn’t much to go on other then you missed setting something up. Your colliders. One is a trigger. One has a rigidbody. Just make sure things are setup right.