load script problems 2

now it still does not trigger when i walk in the game obkject trigger assinged box can you help me again?

function OnTriggerEnter (other : Collider) {
    Application.LoadLevel (1);
    }

2 Answers

2

there are conditions to be met for the trigger to work.

  1. one of the objects should have a rigidbody attached however it could be a kinematic one (i.e isKinematic set to true).
  2. both objects should have a collider attached and the isTrigger property should be set to true.
  3. the script should be enabled.
  4. the layers that objects are in, should have collisions enabled with eacother enabled. the setting is in edit/porject settings/physics in a matrix.

check these all and then it should work.

Hey if you want it to work this is what you need to do:

    function OnTriggerEnter (other : Collider) {

    if(other.gameObject.tag == "Player"){

Application.LoadLevel ("Put your level name in here"); // for example if it is "1" put the following: "grassLand" that is meant to be the scene name.

}

}

this script needs to be attached to the object not the main player :) and make sure the object is an trigger and that should do the trick :)

hope this helps :)