How do I teleport from one scene to another?

Hello,

I would like to know how I can teleport from one scene to the other. I have a first-person controller and camera, and I want it so that when the player walks through the collider trigger, he gets ported to another scene.

I’m just starting to learn Javascript however and I really need some help with this.

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

In your Build Settings( File > BuildSettings > add current) add both of your levels, the one you are currently in, AND the one you wish to teleport too.
In the Build Settings, Unity will list these 2 levels with numbers to the right of them. The number of the level you wish to teleport to, goes inside the above code bracets labeled (int). So if you are going from level/scene 1 to level/scene 2,
the code would then read:

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

Attach this snippet to your collider and you should be good to go.
Enjoy

Seems to work, but how do I specify where the player teleports to in the other scene? The location in the scene?

If there’s only one teleporter location in the other scene, simply have the player start at that location.

If there’s more than one teleporter location and you need to ‘remember’ which one the player should arrive at from one scene to the next, then you can use any of the standard methods of handling data that persists between scenes. Common solutions are static variables, game objects that’ve been made persistent using DontDestroyOnLoad(), or PlayerPrefs (the latter being most appropriate when you want the data to persist between runs of the application rather than only between scenes).

How do I add these “PlayerPrefs”?

If you want to go with PlayerPrefs, just check the docs and/or search the forums for ‘playerprefs’ and you should find plenty of info.