Example #1
0
 // When this game object intersects a collider with 'is trigger' checked,
 // store a reference to that collider in a variable named 'other'..
 void OnTriggerEnter(Collider other)
 {
     if (isServer)
     {
         // ..and if the game object we intersect has the tag 'Pick Up' assigned to it..
         if (other.gameObject.CompareTag("Pick Up"))
         {
             // Make the other game object (the pick up) inactive, to make it disappear
             other.gameObject.SetActive(false);
             // Add one to the score variable 'count'
             SetCount(_count + 1);
             _gm.CheckAndSendWinMsg();
         }
     }
 }