Load Save with fade out/fade in.

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
62qBruv
Posts: 22
Joined: Sun Jul 12, 2020 5:38 pm

Load Save with fade out/fade in.

Post by 62qBruv »

I'm having a stab at making my own menu. I've got "New Game" button sorted with a fade out and fade in. It works fine. I've also got the "Quit" button sorted too. ( I'm just using "On Click ()" events for everything, I'm useless at coding).

My difficulty is with my "Load Last Save" button. I can load from slot okay but I want to fade out to black and then fade in to the loaded save to hide the abrupt transition via the Spawnpoint. Is there an existing script or something I can attach to a game object and call with the On Click () event? I'm sure that must be somewhere in the DS armory but I can't seem to find it.

Oh, seasons greetings to everyone :D
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Load Save with fade out/fade in.

Post by Tony Li »

Hi,

Add this prefab as a child of your Dialogue Manager:

Assets / Plugins / Pixel Crushers / Prefabs / Art / SceneFaderCanvas.

Then add a StandardSceneTransitionManager component to the Dialogue Manager, or whichever GameObject has your SaveSystem component. (Take a look at the Dialogue Manager in the Dialogue System's demo scenes for an example.)

sceneTransitionManager.png
sceneTransitionManager.png (93.67 KiB) Viewed 749 times

Any time you change scenes using the Dialogue System, it will use the transitions you've configured on your StandardSceneTransitionManager. Examples of when the Dialogue System changes scenes are:
  • Starting a new game by calling SaveSystemMethods.RestartGame (e.g., add SaveSystemMethods to a UI Button so you can configure the Button's OnClick() to call SaveSystemMethods.RestartGame).
  • Loading a saved game by calling SaveSystemMethods.LoadFromSlot.
  • Changing scenes using SaveSystemMethods.LoadScene or the LoadLevel() sequencer command or a ScenePortal component.
The Dialogue System Extras page also has some preconfigured save system prefabs, including a Save System GameObject that shows an intermediate loading screen as well as fading to/from black in case you're interested in that. (Search for "SaveSystemPrefabs".) It also has a ScenePortal prefab.
62qBruv
Posts: 22
Joined: Sun Jul 12, 2020 5:38 pm

Re: Load Save with fade out/fade in.

Post by 62qBruv »

Thank you, I've done all that and it sort of works. It fades OUT nicely but it doesn't fade IN the new scene or the loaded save. Ive set the SceneFaderCanvas as a child of Dialogue Manager and that looks okay.

Obviously I'm doing something wrong. But what?

I'll attach a screenshot of my setup in case you can see what I'm messing up.
Attachments
Fader Setup2.png
Fader Setup2.png (161.76 KiB) Viewed 743 times
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Load Save with fade out/fade in.

Post by Tony Li »

Hi,

Does your Dialogue Manager GameObject have the SaveSystem component, too? You're not doing anything to destroy the Dialogue Manager when the scene unloads, are you? Have you changed the animations or animator controller on the SceneFaderCanvas?

As a test, if you add the Dialogue System's DemoScene1 and DemoScene2 to build settings, play DemoScene1, and use the door on the left to go to DemoScene2, does it correctly fade out and back in?
62qBruv
Posts: 22
Joined: Sun Jul 12, 2020 5:38 pm

Re: Load Save with fade out/fade in.

Post by 62qBruv »

Tony Li wrote: Mon Dec 21, 2020 9:50 pm Does your Dialogue Manager GameObject have the SaveSystem component, too? You're not doing anything to destroy the Dialogue Manager when the scene unloads, are you? Have you changed the animations or animator controller on the SceneFaderCanvas?
Yes, the Dialogue Manager has the SaveSystem component on it. No, to the other questions.

I tried the demo scenes and realised the fade in of the new scene is very subtle and doesn't stay long enough in the "black" to cover the ugly parts of the scene or save game loading sequence. So only then did I start messing about with the
SceneFaderCanvasAnimator. Cutting the story short I found that changing the speed on the Fade To Black node to 0.5 and the speed of the Fade From Black node to -3 gave me just what I wanted. (Just changing the duration numbers in the Standard Scene Transition Manager didn't seem to help me much - I left Show at 2 and 0 and left Hide at 0 and 0.)

Thank you for all the information. I'm now going to use the Portal Prefabs for scene changes and try to get transition scenes working, Once more, Thank you so much. This is a great asset.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Load Save with fade out/fade in.

Post by Tony Li »

Glad to help!

If you're using the SaveSystemPrefabs package on the Extras page, I believe it has a different animator controller that works nicely in conjunction with loading screens. (After it fades to black and loads the loading screen, it hides the black cover so the player can see the loading screen. Then it shows the black cover again once the destination scene is loaded so it can fade back in nicely.)
62qBruv
Posts: 22
Joined: Sun Jul 12, 2020 5:38 pm

Re: Load Save with fade out/fade in.

Post by 62qBruv »

In case someone else tries this, I found it important to leave the "Pause During Transition" box UNchecked on the Standard Scene Transition Manager. In my case leaving it checked meant the LoadFromSlot function didn't complete - so no game was loaded. With the box unchecked it all worked as expected.
User avatar
Tony Li
Posts: 22108
Joined: Thu Jul 18, 2013 1:27 pm

Re: Load Save with fade out/fade in.

Post by Tony Li »

Hmm, that shouldn't happen. If you want to investigate it in your project, let me know. Otherwise, if you're fine with leaving it unticked (which provides a smoother transition anyway since it doesn't pause everything as the transition manager fades out), we can drop it.
Post Reply