Hi, I'm trying to be in control of the timing between scene changes so our LoadingScreen always has a chance to display somewhat so things don't feel glitchy, so to do this I have a LoadingScreen Prefab that is a Menu with AppearType:WhileLoading.
We have the global setting "Scene loading requires manual activation?" checked, as well as Async scene loading and "Always reload scene when loading a save file?" so that the scene is always refreshed.
It works perfectly fine if I directly call a scene to load, my code in the LoadingScreen runs, and then eventually calls KickStarter.sceneChanger.ActivateLoadedScene() when we want the new scene to finally activate.
But if I do a Save>Save or load>Load Game action, it just goes black instead of showing the LoadingScreen prefab and loads the scene, without ActivateLoadedScene() ever needing to be called. And if I uncheck "Always reload scene when loading a save file?" , it again doesn't respect needing that function to be called, but just loads the scene insanely fast and I see nothing in-between really.
Any help would be appreciated, perhaps this is a bug, it's hard to tell. Thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @Invertex.
Are you making use of loading screens, and what are your AC/Unity version numbers?
Is this in the case that you load a save from the same scene that it will load, or is a different scene being loaded? If the former, this would be the expected behaviour: the activation is to do with the opening of scenes, rather than for the application of saved data once inside the correct scene.
Not the LoadScreen scene feature, just the Menu based UI Prefab option, with it set to show it "While Loading".
2021.3.2f1, AC 1.75.2
From the same scene. But shouldn't loading a save be considered a trigger for the "While Loading" Appear Type?
But regardless, the primary issue is when that "Always reload" option is on, since we do want it on. With it on, the LoadingScreen is still not displayed correctly despite a scene reload happening. It instantly loads and shows it for a split second, not caring about that ActivateLoadedScene() method being called. Works fine if manually calling a change scene, but I haven't tested for using LoadSave that loads a different scene.
Recreated, thanks for the details.
It's a tricky issue, however. The "safest" way to allow for this is to make use of a loading screen - even a blank screen - so that the game has a chance to unload the original scene before loading the new one.
It may, however, be possible to force this by opening up AC's SceneChanger.cs script and changing lines 565/589:
to:
Does this cause it to then work?
That did the trick, thanks!
As for the Loading Screen scene method, it seemed overkill versus simply having that persistent LoadingScreen prefab. And also would it still be able to track the loading the next scene? Perhaps I'll give it another trying getting that working.
The next scene will be loaded once AC switches to the loading screen - it's just an interim scene that allows the previous scene to be fully unloaded before the next one is loaded.