Fade from Black not triggering

Announcements, support questions, and discussion for the Dialogue System.
User avatar
rykaan
Posts: 75
Joined: Tue Feb 11, 2020 6:22 am

Fade from Black not triggering

Post by rykaan »

Hi Tony,

I've run into an issue (that I've been ignoring for ages) where the fade from black scene transition is skipping through/not triggering correctly. I've embedded a video below showing what's going on.



The animation speed:
Fade from black.jpg
Fade from black.jpg (50.26 KiB) Viewed 1223 times
It doesn't seem to matter if I change the animation duration/min transition duration or the Speed of motion in the Scene Fader Canvas's Animator. I get the same result. I tried adding a load screen and turning off the pause during transition option too, with no luck. Any idea what I'm missing? My dialogue Manager is retained through all these transitions so I doubt it can be losing track of it.

Cheers,
Rob
User avatar
Tony Li
Posts: 21989
Joined: Thu Jul 18, 2013 1:27 pm

Re: Fade from Black not triggering

Post by Tony Li »

Hi Rob,

How are you triggering the fade? Is it through the Standard Scene Transition Manager? If so, is the Animator on a GameObject that survives scene changes? Can you compare it to the scene change setup in DemoScene1 -> DemoScene2?
User avatar
rykaan
Posts: 75
Joined: Tue Feb 11, 2020 6:22 am

Re: Fade from Black not triggering

Post by rykaan »

Hi Tony,

Thanks for getting back to me. I understand it a little better and have managed to narrow it down. So the Fade was triggering correctly but I had been fiddling with the settings and had made the transition really short. But that was compounded by the actual issue I'm trying to solve. See the video below.



What appears to be happening is the Fade to black skips a portion of the start based on how long the scene being loaded takes to load (The scene with the doors etc has far more stuff in it to load). No change to the Transition Manager settings allows me to hide the characters being moved to the correct position, because the black screen covering it is 50%+ transparent at the point when that move is triggered. I hope this makes more sense.

Cheers,
Rob
User avatar
Tony Li
Posts: 21989
Joined: Thu Jul 18, 2013 1:27 pm

Re: Fade from Black not triggering

Post by Tony Li »

Hi,

The StandardSceneTransitionManager's Animation Duration and Min Transition Duration should be at least as long as the animation clip. I know you said no changes have any effect, but please try setting both of those values to, say, 2.
User avatar
rykaan
Posts: 75
Joined: Tue Feb 11, 2020 6:22 am

Re: Fade from Black not triggering

Post by rykaan »

I tried with 2 and 4 second delays on all duration times and I get the same thing sorry Tony.



The fade in animation seems to kick in part way in, based on the load time. The transition duration does push back the player getting control just fine, but doesn't extend the opaque black over the scene loading. I could potentially bodge a fix where I add some full black animation in the scene fader canvas animator before playing the Fade from black animation. Not ideal though. Let me know if there's anything else I should try.

Cheers Tony, sorry to be a bother.
Rob
User avatar
Tony Li
Posts: 21989
Joined: Thu Jul 18, 2013 1:27 pm

Re: Fade from Black not triggering

Post by Tony Li »

Hi Rob,

I'll try to reproduce this using the settings in your videos (thanks for those, btw) and get back to you later today.
User avatar
Tony Li
Posts: 21989
Joined: Thu Jul 18, 2013 1:27 pm

Re: Fade from Black not triggering

Post by Tony Li »

What version of Unity are you using?

I wasn't able to reproduce the issue, but in your video it looks like maybe the Hide trigger's transition to "Fade From Black" is causing it to jump to the ~75% mark in the animation.

Are you using the SceneFaderCanvas prefab included with the Dialogue System? Have you modified it? If so, can you try using the original, unmodified version?
User avatar
rykaan
Posts: 75
Joined: Tue Feb 11, 2020 6:22 am

Re: Fade from Black not triggering

Post by rykaan »

Hi Tony,

So I had been using Unity version 2019.3.0f6 up until now. But I have updated to the recommended build - 2020.3.13f1 to check and it is still happening. I've added another video below to show this occurring between two scenes with a decent amount of stuff in them to load.



Notice that when loading into the sewer level, the amount of fade to black bar skipped is about 40-50%, but when going from the sewer to the Lab again it's around 70%. This makes me think the fade animation is starting before the player sees it by some amount based on the load time of the level. I have added images below of my SceneFaderCanvas settings. I don't believe I changed anything in them.
Scene Fader Canvas Settings.jpg
Scene Fader Canvas Settings.jpg (158.04 KiB) Viewed 1190 times
And below I added a screenshot of my Animator entry and exit times just to make sure I haven't done anything silly with them. The entry time is unchanged, but I may have changed the exit time to give it the full animation time before transitioning as a test of what is going on. I get the feeling that the transition from 'Any State' to Fade from black is happening too early from what I'm seeing on screen.
Animator Entry Time.jpg
Animator Entry Time.jpg (217.97 KiB) Viewed 1190 times
Animator Exit Time.jpg
Animator Exit Time.jpg (172.48 KiB) Viewed 1190 times
Sorry for the massive post. I hope some of this is useful to narrow it down.

Cheers,
Rob
User avatar
Tony Li
Posts: 21989
Joined: Thu Jul 18, 2013 1:27 pm

Re: Fade from Black not triggering

Post by Tony Li »

Hi Rob,

What method are you using to change scenes?
User avatar
rykaan
Posts: 75
Joined: Tue Feb 11, 2020 6:22 am

Re: Fade from Black not triggering

Post by rykaan »

Hi Tony,

I'm using a very slightly modified version of the ScenePortal script to move between the scenes shown in the videos. The modification is to track character facing and to update the Game Manager with audio transitions between scenes. I'll put the code below:

Code: Select all

private void OnTriggerEnter2D(Collider2D other)
        {
            if (!other.CompareTag(requiredTag)) return;
            Debug.Log("Game Manager Facing: " + GameManager.instance.initialCharacterFacing);
            GameManager.instance.SetCharacterInitialFacing(postPortalCharacterFacing);
            GameManager.instance.GetComponent<AudioManager>().CheckAndFadeSceneTransition(m_destinationSceneName);
            UsePortal();
        }
The facing line just changes an int that OnStart my characters apply to their animators.

Code: Select all

private void Start()
    {
        if (GameManager.instance.initialCharacterFacing != -1)
        {
            animator.SetInteger("Initial Facing",
                GameManager.instance.initialCharacterFacing);
        }
        playerInputControlScript = GameManager.instance.GetComponent<PlayerInputControlScript>();
    }    
The AudioManager line checks what the music in the following scene is and triggers a coroutine if it is different to fade out and in to the new scene.

Code: Select all

public void CheckAndFadeSceneTransition(string nextSceneName)
    {
        string nextSceneAreaMusic = GetSceneAreaMusic(nextSceneName);
        if(currentMusicPlaying != nextSceneAreaMusic)
        {
            TriggerFadeOutMusicCoroutine(currentMusicPlaying, 1.5f);
        }
    }
I would ask if the coroutine might interfere with the fade somehow but in the earlier videos I was moving between two scenes with the same music, so nothing happens, it just continues playing the current track.

The other scene transition method I've used is the LoadFromSlot going from the main menu which does also cause the issue.

Code: Select all

public void LoadGame()
    {
        if(loadingGame != true)
        {
            loadingGame = true;
            GetComponent<SaveSystemMethods>().LoadFromSlot(0);
        }        
    }


I don't really know if this is useful or completely irrelevant, but if I pause the game and step through it with the step forward one frame button the issue doesn't occur. I'll put another video below.



I know things can behave kind of weird when doing this but it might confirm/disprove some ideas. I hope that's enough new information to get a better idea of what might be happening. Sorry I couldn't respond again last night, it was getting a little late over here.

Cheers again,
Rob
Post Reply