Problem making a Finishzone.

Hi!

I'm trying to make a script that, when the player enter a spot or an objekt he wins. Like a Finishzone. And I want it to load my finalscen.

I tryed to script like this-

function OnCollisionEnter(other : Collision) {
  if(other.gameObject.tag == "Player") {
       //end game here
    Application.LoadLevel (5);
  }

}

As you can see my script skills is not that good. :) Please help :) Thanks

Your script needs to be attached to your player object. Then you should make an empty GameObject and attach a collider it. In the Inspector view of the GameObject you can toggle the property isTrigger from your collider on and off. I advice you to set it to on, then your player won't collide with the object but be able to walk "through" it. If you do so you have to use OnTriggerEnter() instead of OnCollisionEnter(). In the manual it says:

function OnTriggerEnter (other : Collider) : void Description

OnTriggerEnter is called when the Collider other enters the trigger.

This message is sent to the trigger collider and the rigidbody (or the collider if there is no rigidbody) that touches the trigger. Note that trigger events are only sent if one of the colliders also has a rigidbody attached.

As the Collider parameter offers the variable other.gameObject too you should be able to reuse your code without further changes.