- Home /
Scene with few entrances/exits
I want to connect 3 scenes Scene 1 (one entrance) Scene 2 (one entrance to Scene1 and one to Scene 3) Scene 3 (one entrance to Scene2)
How can I do 2 entrances to Scene 2 to have custom spawn on another scene?
I have created this code, but I do not understand how to implement custom respawn when going from scene Desert to Land South for example:
public class Transfer1_2 : MonoBehaviour
{
// Update is called once per frame
void Update ()
{
}
void OnTriggerEnter(Collider myTrigger)
{
if (myTrigger.gameObject.name == "T_PS_BL")
{
Debug.Log("Welcome to Lands North");
Application.LoadLevel(1);
}
else if (myTrigger.gameObject.name == "T_BL_PS")
{
Debug.Log("Welcome to basecamp");
Application.LoadLevel(0);
}
else if (myTrigger.gameObject.name == "T_GL_BL")
{
Debug.Log("Welcome to Lands South");
Application.LoadLevel(1);
}
else if (myTrigger.gameObject.name == "T_BL_GL")
{
Debug.Log("Welcome to Desert");
Application.LoadLevel(2);
}
}
}
Answer by Joshua · Aug 17, 2011 at 10:19 PM
Have either a static variable or a script which has DontDestroyOnLoad to keep track of the last trigger you entered. Then you can have your spawnpoint depend on what it says.
Answer by LunaRain · Aug 18, 2011 at 06:37 AM
Ye, it is really cool but I dont understand how to implement this :( I'm entering on trigger T_BL_GL and going to another scene then teleporting to point. How to encode this in c#?