Detect which object collided

Hi,
I have 1 object that can be hit my different objects.
How can i check if it hit with Object A or Object B?
below the very simple function to just destroy the gameobject, but if i dont want it to be destroy if object B hit it. please advice

function OnTriggerEnter (col : Collider ) {
	

	Destroy(gameObject);
}

Tag the object you want to cause the destruction as ObjectA, and than test for the tag…

Try this out.

function OnTriggerEnter (col : Collider ) {
    if(col.transform.tag == "ObjectA"){    
        Destroy(gameObject);
    }
}

Another variant is : ( if you have obj A,B,C and A C destroy )

function OnTriggerEnter (col : Collider )
{
if (col.gameObject.name == A != col.gameObject.name == C)
{
Destroy(gameObject);
}
}