Ok so iv been trying to make a script and keep failing. I want it so that when an object touches another object, a event happens (Such as it prints on the screen "You won!")
- My box is called "bluecube"
- My collider that if bluecube collides with it i want something to happen is called "bottom-collider"
so i tried this script - (this failed)
var bluecube : Transform;
function OnControllerColliderHit(collision:Collision)
{
if(collision.gameObject == "bluecube")
{
Destroy(bluecube);
}
}
what i wanted it to do is that when the bluecube comes into contact with the object that has this script attached it will destroy the bluecube.
Thanks in advance!