Help with scripting error

hi all professional scripters,

let me explain whats going on

  • i created a TD game. And i wanted my game switch to next level when my last enemy collide with the cannon(projectile) shot by my towers.

  • below are the script i used to attach to the last enemy

var myLevel : String;

 function OnCollisionEnter (myCollision : Collision) {

	if(myCollision.gameObject.name == "cannon(Clone)"){
         // i tried cannon instead of cannon(Clone) as well.
 
         Application.LoadLevel(1);

	}

}

your help will be much appreciated. Thanks for your time

what error does it give you, whats wrong?

it doesnt give me any error, just the new map doesnt load when it trigger/collide

Welcome to the forum, unavdoiable!

A good way to handle this would be to create a new tag for the projectiles and use that for the comparison:-

if (myCollision.gameObject.tag == "Projectile") {
   ...
}