Forum rules - please read before posting.

Scene takes forever to load the second time you enter it (URGENT!)

Using unity 5.6.0, AC 1.56g

Entering a scene for the first time seems fine. When entering that one particular scene again - and every time after that - the loading time is abysmal...

Took a screenshot of a profiler, but not sure what the big spike at the start of the room is:

Guys, this is kinda urgent, as the game released last night on Steam, GOG and Humble... and I think for some people it crashes (either that or load is so long that they give up and quit). Please help! I need to fix is ASAP.

I've switched everything on and off and it still does that. I'm literally running out of ideas...

The scene's hardly got anything in it - just a 2D background, some objects in front, a couple of small particle systems and 2 hotspots. Is it the speech audio doing it? (read some other threads saying the game could be looking for audio files and there's 7.5K voice files in the game) There are far more complex scenes in the game, with lots of 3D objects in them and long dialogues, and they load fine. It's just this one...


  • I don't know much about AC or Unity but can throw some ideas your way. Maybe it will help:

    Could it be a leak which is triggering upon entering the scene?

    And has built up by the time you're loading the scene again?

    Does the scene run slow if you stay in it for a long time?

    Is it only slow loading THAT scene after entering it?

    What does the Console say when you enter that scene?

  • edited April 2019

    Click on the spike in your Profiler to reveal more information about it. Be sure to also enable "Deep Profile" too.

    It could well be the speech audio. Are you auto-assigning them by name in Resources folders? With 7.5k of them, that'll indeed be a resource hog - but if only this scene takes a long time, it may be a red herring. One way to quickly rule it out would be to duplicate the project, and then remove the speech audio from Resources. How does that improve things? Relying on Asset Bundles can drastically reduce such load times, but it requires the latest AC.

    Is it just this scene that has such an issue? Please share as many details about it as you can. Does it have a local Player object, and what Remember components? That the delay kicks in upon reloading suggests this is related to the loading of saved scene data. If such loading involved asset file (e.g. changing of AudioClip / Material assets), you could try moving such files into "Resources/SaveableData" subfolders as covered by the Manual's "Performance and optimisation" chapter.

  • I found it! And you'll never believe what it was...

    First of all, there were 3 or 4 scenes in the game that did this. First load ok. Second - SLOOOOOOOOW (and we're talking between 30 seconds slow up to an hour + crash slow). But what grabbed my attention was that the room's sound was starting to play during that long wait... so...

    ...I kept digging... and it turned out it was one of the room's sound objects, set to play room ambience sounds on a loop and "on awake". Now, I've used sounds playing on awake all over the game and they don't normally do this... but in some scenes it turns out they do. Big time.

    Solution to that was using sound: turn off action upon leaving the scene. Then it doesn't matter if the sound plays on awake or not - as long as you turn ot off before leaving scene.

    I realize I'm using a pretty old version of AC... so probably it's been fixed by now. Or maybe I'm just stupid for not turning the sound off, I dunno. I'm just glad I've found it (though to be honest I'm pretty sure it still does that long wait if I save game in that room with looping sound playing and reload - so if you have any idea how to fix that please let me know ;) )

  • Is this associated with specific Sound and RememberSound components?

    v1.60 brought the Sound: Play ambience Action, which is the recommended way of playing looping ambient sounds in a scene - as this does away with the need to have a dedicated Sound object present in the scene, and the playback state is saved/loaded automatically.

    If your Sound also has a RememberSound component, then it's likely as I suspected and to do with the loading of the AudioClip asset at runtime. Your version of AC should support the Saveable folder method - see chapter 13.6 for more on this topic.

  • Hmm... This could totally help! I'm sure the long load times are caused by sounds. But while moving graphics files around seems like an almost impossible task at this stage, can I just add an Audio folder in SaveableData and dump all sfx and music in there? (that I can do very quickly) I've already got my Speech folder in there (and only that).

  • You'd only need to move audio files that have a RememberSound component, but yes - that should do it.

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.