Run script when player steps in location


I am making a maze game.

I want when the player gets to the middle of the maze, to run script. How should I do this?

I basically want to stop the time and go to another scene, but this I will figure out later.

Thanks, Chris

Put a game object where you want this to happen (can be empty game object). Attach a collider (e.g. cube or sphere) to the game object and set the collider to IsTrigger. You can then use the following function:

function OnTriggerEnter (other : Collider) {
 //load your new scene here or do whatever is needed;
 Application.LoadLevel (1);//or whatever the number of your new level is

In attempting to do this I got some errors so this is how I got around it.

I had to add the scenes to the build settings (under the file tab) and attached this script to the trigger (game object).

var trigger: GameObject;

function OnTriggerEnter (other: Collider) {
	Application.LoadLevel ("Level_2");//the name of your scene in the project panel