Load different scenes using the same loading screen

Hi! I’ve set up my loading screen and everything works properly, but I’d like to be able to use the same one but going to another one

The first one(actually set up): From Main ->(to) Play

The two others I’d like to make

1: From Main ->(to) Tournaments

2: From Play & Tournaments ->(to) Main

*Some specs: I’m making a 2d game, used the method: Application.LoadLevel (“LevelName”);

I’d also not like to have to have to make other scenes and be able to the less job as it is possible.

Thanks in advance

-Jay Michaels, Owner & CEO (Midnight Black Planet) → Google Workspace Updates: New community features for Google Chat and an update on Currents

You could use a PlayerPref to determine which scene to load.

For example :

//In Your MainMenu script
if(GUI.Button(Rect(0,0,100,50),"Scene1")){
PlayerPrefs.SetString("Load","Scene1");
}

if(GUI.Button(Rect(0,100,100,50),"Scene2")){
PlayerPrefs.SetString("Load","Scene2");
}

Then in your loading script you could do something like this :

if(PlayerPrefs.GetString("Load") == "Scene1"){
Application.LoadLevel("Scene1");
}
else if(PlayerPrefs.GetString("Load") == "Scene2"){
Application.LoadLevel("Scene2");
}
1 Like

Yes, nice idea, I’ll check if it works…