How to check for a collisoin between objects

How would I check for a collision between 2 objects some thing like. I looked around but couldn’t find a good answer.

if( sword collides with badguy){

It would be best for any examples to be c# but I dont mind either way


If you had searched the words “unity” and “collision” on google this would of been the
first choice:


you need to have a collider on the sword and the badguy, make sure the sword collider
has “isTrigger” checked in the editor. Then in the sword script you do:

function OnTriggerEnter(iCollider:Collider)

if( == "name-of-badguy-object")


    use this if you want to destroy the badguy after some time (in seconds):

    var TIME:int = 5;





This should work :slight_smile: