This is what i used for the next level portal:
void OnTriggerEnter2D(Collider2D other)
{
if(other.gameObject.tag == "Player")
{
DontDestroyOnLoad(other.gameObject);
Application.LoadLevel("ENTER LEVELNAME HERE");
}
}
This is C# and sorry about that. You must also tag the player as "Player". What this is doing is running this function whenever anything touches it, and if the tag is "Player" it will load the selected level.
P.S If you have a 3D game, just Change "OnTriggerEnter2D" to "OnTriggerEnter", and change "Collision2D" To "Collision".
Thanks! -Alec
↧