Example #1
0
 // when the GameObjects collider arrange for this GameObject to travel to the left of the screen
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.tag.Equals("Door"))
     {
         // It's a door!
         DoorBehaviour doorBehaviour = col.gameObject.GetComponent <DoorBehaviour>();
         doorBehaviour.OpenScene();
     }
     else
     {
         Debug.Log("Else: " + col.gameObject.tag);
         Debug.Log(col.gameObject.name);
     }
 }