Access Fade from script
-
- Posts: 54
- Joined: Mon Jun 21, 2021 7:48 pm
Access Fade from script
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()
- Attachments
-
- Fade.PNG (23.48 KiB) Viewed 13281 times
Re: Access Fade from script
Hi,
Is there a reason why you're not just using SaveSystem.LoadScene() to change scenes? It handles the scene transition manager automatically:
If you want to manually fade out, you can run its LeaveScene() coroutine:
Or you can use a reference to the scene transition manager's animator and set its Show trigger:
(Assuming you're using the default SceneFaderCanvas animator or something similar.)
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");
Code: Select all
StartCoroutine(SaveSystem.sceneTransitionManager.LeaveScene());
Code: Select all
SaveSystem.sceneTransitionManager.leaveSceneTransition.animator.SetTrigger("Show");
-
- Posts: 54
- Joined: Mon Jun 21, 2021 7:48 pm
Re: Access Fade from script
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.
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.
- Attachments
-
- Fade2.PNG (49.72 KiB) Viewed 13269 times
Re: Access Fade from script
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.
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.
-
- Posts: 54
- Joined: Mon Jun 21, 2021 7:48 pm
Re: Access Fade from script
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
Awesome! Glad to help.