Doing something during LoadLevel while the screen is faded

Announcements, support questions, and discussion for the Dialogue System.
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: Doing something during LoadLevel while the screen is faded

Post by AoF »

Tony Li wrote: Sun Jun 16, 2019 10:05 pm The catch is that you can't use "required Fade(in,2)@2" in combination with "Continue()@2" because the Continue() will kill the Fade() in order to let the next node go.
OK, so can't there be two nodes? One that fades out and one that does stuff then fades in?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Doing something during LoadLevel while the screen is faded

Post by Tony Li »

Sure. If that fits your case, then the first node's sequence can be:

Code: Select all

Fade(stay,1);
LoadLevel(Bedroom)@1;
Continue()@2
And the second node's sequence:

Code: Select all

Fade(in,1); {{default}}
I had made the assumption that LoadLevel() was on the last node of the conversation. If it's the last node, it's a little more complicated because there isn't another node to run the Fade(in,1) command.
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: Doing something during LoadLevel while the screen is faded

Post by AoF »

Tony Li wrote: Sun Jun 16, 2019 10:36 pm I had made the assumption that LoadLevel() was on the last node of the conversation. If it's the last node, it's a little more complicated because there isn't another node to run the Fade(in,1) command.
Ah, you're right. I have both situations, actually, so this helps for one of them. Thanks!
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Doing something during LoadLevel while the screen is faded

Post by Tony Li »

I added "unstay" to the Fade() sequencer command:

Code: Select all

Fade(unstay,1)
It works like Fade(in) except that if the screen is currently visible, then it will not fade from black.

DS_SequencerCommandFade_2019-06-17.unitypackage

This is how I set it up in my test scene:

1. Used this sequence:

Code: Select all

Fade(stay,1,#ff0000);
required SetActive(New GameObject To Show, true)@1;
required LoadLevel(DemoScene2)@1;
Continue()@1
2. Added this Dialogue System Trigger to the SceneFaderCanvas:
Image

3. Configured the Scene Transition Manager's Enter Scene Transition > OnTransitionEnd() to trigger the Dialogue System Trigger:
Image
You could just as well add it to the OnTransitionStart() event instead. I just happened to add it to the other one.

What this does: Whenever you load a new scene, the Scene Transition Manager will run Fade(unstay,1). If the screen is visible, it won't do anything. If the screen has been faded to black, it will fade back in to make the screen visible.
AoF
Posts: 241
Joined: Sun May 12, 2019 8:36 pm

Re: Doing something during LoadLevel while the screen is faded

Post by AoF »

What does, "if the screen is visible mean?" What would it mean for the screen to not be visible?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Doing something during LoadLevel while the screen is faded

Post by Tony Li »

The Fade() command creates a canvas at runtime. It keeps this canvas around for future Fade() commands, too.

The canvas has a fullscreen black image. When you fade out, it sets the alpha value of the black image to one, making it completely opaque. When you fade in, it sets the alpha value to zero, making it completely invisible.

"Screen is visible" is (poorly worded) shorthand for when the Fade() command's canvas alpha is zero -- that is, the canvas is not visibly covering the screen.

"Screen is not visible" means that the Fade() command's canvas alpha is one -- that is, the canvas is visibly covering the screen with the fullscreen black image.
Post Reply