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;
}
}
function OnCollisionExit(collision : Collision)
{
renderer.material.color = Color.yellow;
}
I created a new cube as tagged “BuildObject” and i added rigidbody and box collider with checked isTrigger to this Cube. But my object when touch to this Cube i can’t change my object color.
Where is my problem can you help me ?
Regards
Vincenzo