I want to make it when objects collide they destroy each other

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class collison : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    void OnTriggerEnter(Collider other)
    {
        Destroy(gameOject);
        Destroy(other.gameOject);
    }
}

@tom2349 You need to destroy the other game object first before the script game object

void OnTriggerEnter(Collider other)
     {
         Destroy(other.gameObject);
         Destroy(gameObject);
     }