Forum rules - please read before posting.

Scene:Switch issues

Hello Chris,

AC = 1.74.2
Unity = 2020.3.16f1

We have faced with the strange issue during the Scene:Switch action.

For example we have two scenes: Scene1 and Scene2

If we run each of these scenes in Unity Editor in playmode - they run well without any issues.

If we run Scene1 and then switching to Scene2 with Scene:Switch action Unity Editor starting to use abnormal RAM size (up to 28 GB, as I have 32 GB of RAM) and then Unity stuck and need to be stopped via Task Manager.

Maybe you have any thought why this happening?

Best regards,
Pavlo
Triomatica Games

Comments

  • There's not enough detail to be able to tell the cause, but Unity's Profiler should shed some light.

  • Yes, I know, but the problem is that profiler is also freezes and stop updating any information when Scene:Switch action is triggered

    https://imgur.com/a/if1ssK7

  • Does this occur when both scenes are fresh AC scenes, without anything custom? This includes your "EventSystemNew" object.

    If so, replace your Managers with the default/demo set - if that works, revert your Managers one by one to see if one specifically is causingn an issue.

  • Does this occur when both scenes are fresh AC scenes, without anything custom? This includes your "EventSystemNew" object.

    If I create two empty scenes in current project (with the same Managers and EventSystemNew prefab) - switching between them is working properly.

    The problem, as I understood, in graphics (or Atlases) - the more graphics, the more resources is needed during Scene:Switch.

    BUT

    The strange thing here is that the same "heavy" scene launches instantly if I run it separately in Playmode and the same scene hangs Unity if it launched via Scene:Switch action.

  • Strange indeed, though if it is a case of graphics then I'd say AC isn't involved here - I'd expect you'd get the same issue if you weren't switching the scene using AC.

    You could test this with a custom script that calls Unity's LoadScene function directly.

  • You could test this with a custom script that calls Unity's LoadScene function directly.

    Unfortunately this isn`t helped

    This is offtop question, but it may be connected. Maybe the way we work with Atlases makes difference? We can do one big Atlas for all sprites in the scene and we can do separate Atlases for each animation. This is not making any difference in scene loading time, but what is your suggestion, which one should be better?

  • There's no "one size fits all" approach - it really depends on the specifics of your project.

    The Manual's "Performance and optimisation" chapter covers AC-related tips you can look into to improve load times. The "Use Timeline for cutscene animation" entry may be relevant if animation data is a factor in your case. When it comes to general graphics optimisation, however, Unity's general optimisation factors apply.

  • Hey Triomatica, I had almost the exact same issue. What helped was creating Atlases of the sprites and set the Culling Mode of the animators to "Cull Completely".

  • edited May 2022

    Hello DctrElectro,

    set the Culling Mode of the animators to "Cull Completely".

    Thank you! I confirm that this is the solution of our problem. After setting all animators on the scene to "Cull Completely" - scene loads instantly both if launched separately in Playmode and if launched with Scene:Switch action.

    DctrElectro, please check your private messages.

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.