Hi, I’m developing a game where I need to go back and forth between two scenes.
Something like Henry Hatsworth in the Puzzling Adventure on the DS and Legend of fae on PC. Where I have a visual/battle part (scene 1) and a puzzle part (scene 2).
I tried working with 2 scenes and switching between them using
Application.LoadLevel(1);
I even used static values in the start function to make sure that my variable don’t get initialized every time I switch. However, every time I switch
// I forgot to add the static here
private static bool firstTimeHere;
void Start()
{
if (firstTimeHere == true)
{
//initlizations
}
}
However, I keep getting problems like null references and the prefabs that were instantiated are gone.
Is there is a better way to do this? Or is there is a way to make the prefabs stay?
Thanks in advance
That would be possible as well, through static variables and DontDestroyOnLoad for the gameobjects. But it sounds complicated to me.
– Berenger