Page 1 of 1

Access Fade from script

Posted: Wed Jan 03, 2024 10:32 am
by xyztankman
Is there a quick command to fade from script? I am currently trying to fade out when loading a scene (I'm actually putting the fade command in a coroutine instead of the function but that's not in the screenshot) but I get this error when attempting to use SaveSystem.sceneTRansitionManager.FadeOut()

Re: Access Fade from script

Posted: Wed Jan 03, 2024 11:19 am
by Tony Li
Hi,

Is there a reason why you're not just using SaveSystem.LoadScene() to change scenes? It handles the scene transition manager automatically:

Code: Select all

SaveSystem.LoadScene("your-scene-name");
If you want to manually fade out, you can run its LeaveScene() coroutine:

Code: Select all

StartCoroutine(SaveSystem.sceneTransitionManager.LeaveScene());
Or you can use a reference to the scene transition manager's animator and set its Show trigger:

Code: Select all

SaveSystem.sceneTransitionManager.leaveSceneTransition.animator.SetTrigger("Show");
(Assuming you're using the default SceneFaderCanvas animator or something similar.)

Re: Access Fade from script

Posted: Wed Jan 03, 2024 1:07 pm
by xyztankman
I was actually using only

PixelCrushers.SaveSystem.LoadScene("SceneMainMenu");

previously but it seems the fade stopped working for some reason. could it be because I don't have a SceneFaderCanvas in the prefab of the dialogue manager? I opened an empty project and imported the latest dialogue manager from the asset store and didn't see a SceneFaderCanvas listed on the dialogue manager either.

I was able to fade by using a dialogue trigger and setting a fade in the sequence while executing a couple functions for scene change but the coroutine method did not work as well.

Re: Access Fade from script

Posted: Wed Jan 03, 2024 4:05 pm
by Tony Li
Hi,

The base Dialogue Manager prefab doesn't have a SceneFaderCanvas since not project will use the save system or change scenes. The Dialogue Manager prefab variant used in the Demo does have a SceneFaderCanvas. There's also a separate SaveSystemPrefabs package (direct download) on the Dialogue System Extras page that comes with a fully configured Save System prefab and other useful prefabs.

Re: Access Fade from script

Posted: Wed Jan 03, 2024 5:42 pm
by xyztankman
Thanks Tony, I grabbed it from there, I was sure I saw it somewhere but forgot it was in the demo! Got it configured and it's looking great, also easy way to use my own loading screen if I wanted.

Re: Access Fade from script

Posted: Wed Jan 03, 2024 9:17 pm
by Tony Li
Awesome! Glad to help.