Collision doesn't work !! help

function OnCollisionEnter(collision : Collision){
if(collision.gameObject.tag=="ap"){
Debug.Log("lllll");
}
}

this is the code that i use . what is wrong ? in the code or in the character that we use.. ?? thx ...

use the Collider not the collisions' GameObject.

void OnCollisionEnter(Collision c) {
    if (c.collider.CompareTag("ap")) {
    ......
}