Forum rules - please read before posting.

Crossfading scenes no longer seems to work

After updating an older project to Unity 2019.3.6, switching to URP and updating AC to 1.71.4, the crossfading of scenes no longer seems to work.

My setup: player taps hotspot in scene XXX --> hotspot interaction (use): scene: switch YYY ("Overlay current screen during switch" checked) --> switch to scene YYY happens --> scene YYY has Cutscene OnStart / OnLoad set to run in background; this cutscene includes one action only:

  • when using Camera: Switch (like the current manual advises on page 191), Transition Time: 2, no fade happens at all. Instead the camera cuts to black and then, a second later, cuts to the Default Camera of scene YYY
  • when using Camera: Crossfade (which I just chose to try), the same happens
  • when using Camera: Fade (like the tutorial "Switching Scenes" advises), the camera cuts to black and then fades in to the Default Camera of scene YYY from black (so no overlay from previous scene)

Before updating the project, I had the crossfades working, even though I had the issue described in this thread because I am using linear color space too.

Additional notes:

  • both scenes use "SimpleCameras"
  • I both tried the three different actions with "black out when initialising" checked and unchecked in the Scene Loading section of the settings manager.

Comments

  • edited June 2020

    More notes:

    • when using Camera: Fade with "Instant" checked, there is still an app. one second long cut to black between scenes XXX and YYY
    • when using no Camera action or OnStart cutscene in scene YYY at all, the same is true
    • during the cut to black, the whole game window cuts to black, meaning: all visible menus disappear for a moment, too … and so does the "AC status box"!
    • I also noticed that the "AC status box" gets faded in and out as well while the camera fades, and I could swear that this did not happen before either.
  • when using Camera: Switch (like the current manual advises on page 191),

    This is a type - it should be recommending a Camera: Fade Action, like this tutorial.

    I'll attempt a recreation - thanks for the details.

  • I have no issue with crossfading itself, when using the fade Action on the other side.

    However, I did recreate the "too bright" issue when using Linear color space.

    Open up MainCamera.cs, and replace the TakeOverlayScreenshot function (line 638) with the following:

    Texture2D screenTex = new Texture2D (ACScreen.width, ACScreen.height);
    screenTex.ReadPixels (new Rect (0f, 0f, ACScreen.width, ACScreen.height), 0, 0, false);
    
    if (PlayerSettings.colorSpace == ColorSpace.Linear)
    {
        for (int y = 0; y < screenTex.height; y++)
        {
            for (int x = 0; x < screenTex.width; x++)
            {
                Color color = screenTex.GetPixel(x, y);
                screenTex.SetPixel(x, y, color.linear);
            }
        }
    }
    
    screenTex.Apply ();
    screenTex.name = "OverlayTexture";
    screenTex.Apply ();
    SetFadeTexture (screenTex);
    KickStarter.sceneChanger.SetTransitionTexture (screenTex);
    FadeOut (0f);
    

    Does that resolve it?

  • I am afraid I cannot tell, because in my case the "too bright" issue has been replaced by the "does not crossfade" issue after doing the upgrades I described. I cannot afford to revert everything back to Unity 2018 and AC 1.69.X right now, I am afraid.

    I did make the change to MainCamera.cs though – but it didn't resolve the crossfading issue. There still is first a cut to black and then a fade in from black to the new scene.

    So what now …

    Should we try to take a step back and find an answer first to the following (maybe underlying) issue:

    Very simple setup:

    • Scene XXX. Hotspot interaction (Use) with one action only "Scene: Switch" to Scene YYY
    • Scene YYY without any OnStart/OnLoad/FadeIn-stuff whatsoever (so there should be a straight cut from scene XXX to scene YYY

    Result: when running in editor, there still is that short cut to black in between the scenes, during which the game window shows nothing – no menus, no AC status box, no statistics box! Nothing.

    Do you have any idea what might cause this?

  • edited June 2020

    Alright, I just tried to make a minimum build of scenes XXX and YYY in order to find out if this issue is editor-related and/or occurs on the iOS build, too – but when I tried, I got grilled by unity for the inclusion of this new code into MainCamera.cs:

    Assets/AdventureCreator/Scripts/Camera/MainCamera.cs(641,8): error CS0103: The name 'PlayerSettings' does not exist in the current context
    

    ;-)

  • I wasn't suggesting you revert back to anything - the code should be for the latest release. Though, if you're getting that build error just remove the line:

    if (PlayerSettings.colorSpace == ColorSpace.Linear)
    

    And it should compile.

    AC will place a black texture over things while a scene initialises to mask objects being moved / animations being set up, etc. It should rely on the previous scene's "overlay" texture, though. You can prevent this, however, by unchecking Black out when initialising? in the Settings Manager's "Scene loading" section.

  • by unchecking Black out when initialising? in the Settings Manager's "Scene loading" section

    That was something I had under suspicion too, but it is and has been unchecked during all the last attempts. So this cannot be the source, either.

    Let's see what happens in the build … I report back, when it is compiled.

    I wasn't suggesting you revert back to anything

    And I didn't mean to sound rude – sorry if my remark came across that way. I just wanted to point out that I cannot recreate the "too light" issue any longer, as crossfading does not work for me anymore at all right now.

    And as you cannot recreate this behavior on your end, I am a little nervous right now, because currently I have no idea where else to look …

  • Unfortunately, the behavior is on the build, too:

    • Scenes do not crossfade, but fade in from black
    • There is a short cut to black between scenes (even though "blackout" is switched off)
  • edited June 2020

    It may well be unique to your project - or at least your combination of AC and pipeline settings.

    Are you able to create a cut-down, duplicate project that demonstrates the issue with two scenes? If so, zip it up, PM it to me along with instructions on how to trigger it, and I'll take a look.

  • Sent!

    Thank you, Chris.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.