OnCollisionEnter Control Problem

Hello Everybody,

I have a small problem and i need your helps. I write a script as named CollisionController.js and attached to my object.

CollisionController.js ;

function OnCollisionEnter(collision : Collision){
     if (collision.gameObject.tag == "BuildObject")
     {
        renderer.material.color = Color.red; 

} }

I created a new cube as tagged "BuildObject" and i added rigidbody and box collider with checked isTrigger to another object. But my object when touch to this object i can't change my object color.

Where is my problem can you help me ?

is Trigger should be unchecked for rigidbodies that want to have OnCollision series of events. if you want to have triggers then use OnTriggerEnter for them.

for triggers to send events one of the colliding objects should be a kinematic rigidbody.