Page 1 of 1
Scenes transition
Posted: Thu Sep 01, 2022 3:37 pm
by qest43
Hello, so I tried to apply today scenes transition via Scene Portal Script and it works great, also with Scene Fader. But how can I also use it when I start game in Main Menu and click New Game, how can I use this transition function with fader in this case?
Re: Scenes transition
Posted: Thu Sep 01, 2022 5:29 pm
by Tony Li
Hi,
When you click New Game, does it load a different scene? Or is it still in the main menu scene?
If it's in the main menu scene, you can manually trigger the SceneFaderCanvas's animation states (Show and Hide).
If New Game loads a different scene, make sure to load the scene using any of
these techniques. They will use the StandardSceneTransitionManager.
Re: Scenes transition
Posted: Fri Sep 02, 2022 2:09 pm
by qest43
New Game loads a different scene in my case, and I already added
Code: Select all
PixelCrushers.SaveSystem.LoadScene("Area 0");
GameMenu.Open();
to my script and it works. But previously I was using:
Code: Select all
private IEnumerator OnPlayPressedRoutine()
{
TransitionFader.PlayTransition(startTransitionPrefab);
yield return new WaitForSeconds(_playDelay);
Game.LevelLoader.Instance.LoadLevelAsync(1);
GameMenu.Open();
}
And now I have problem, because GameMenu was opening after screen fades out, but now it turns on immediately, and I dont know how to use yield or another solution in that case.
Re: Scenes transition
Posted: Fri Sep 02, 2022 2:14 pm
by Tony Li
Hi,
There are a few ways to do that. Here are some of them:
- You can add a script to your "Area 0" scene. In the script's Start() method, call GameMenu.Open().
- Or hook into the
PixelCrushers.SaveSystem.sceneLoaded event:
Code: Select all
SaveSystem.sceneLoaded += OnSceneLoaded;
void OnSceneLoaded(string sceneName, int sceneIndex)
{
SaveSystem.sceneLoaded -= OnSceneLoaded;
GameMenu.Open();
}
Re: Scenes transition
Posted: Fri Sep 02, 2022 2:20 pm
by qest43
Yes, second option works perfectly, thank you!
Re: Scenes transition
Posted: Fri Sep 02, 2022 3:19 pm
by Tony Li
Glad to help!