Forum rules - please read before posting.

Lag on re enter scene

Hi Chris,

So I am finding that there are** huge inconsistencies in my scenes loading times**, I have played around with action lists that are set on exit scene (like turn off music and camera fade out) but this doesn't seem to be consistent. First time visiting a scene can be ok, but then second time can take ages. Any tips? I have gone through the AC handbook of saving CPU etc, but I am at a loss!

I had someone take a look at the profiler (see screenshot) and he says that he is 100% positive if I temporarily disable the save system (just for check) this problem would go away due to the save system method for some reason is using Resources.LoadAll(). and the save system method, for some reason, is using Resources.LoadAll()

He said then I should focus on making it avoid loading all resources, and that also, down the line, there's AssetLoader.GetAssetFile() which then takes a huge lot of time, and seems redundant.

Any ideas what i need to do to solve this? experiment with disabling this?

I've been told that the profiler shows that it is definitely running the garbage collection. Can I ask if your scene has a lot of Save components and sprites and stuff in it?

i looked at the manual but didn't see much there i could follow that would seem like it would fix the issue.

Check out the screenshot of profiler here:



  • edited October 2022

    Resources are good for development, but you'll want to avoid them in the final release.

    The only Resources objects necessary for AC to run are in the /AdventureCreator/Resources folder, which are accessed once on startup. When it comes to optimising your game, all other Resources folders and objects should be replaced by Addressables.

    The main areas to look into are the use of speech audio files, and assets that are referenced in save-game files. See the Manual's "Speech audio" and "Saving asset references" chapters for details on how to rely on Addressables for these.

    AC can also rely on Addressables for scene files, avoiding the need to place scenes in the Build Settings.

  • So just to clarify the above could help with my issue, which seems to get worse as the game progresses, rather than slow loading happening right away, it gets worse as the game progresses..

    So where do I now put my speech audio files? They are currently in the AC resources folder.

  • If you have many speech audio files in Resources, taking them out will improve performance, yes.

    If you rely on Addressables, you can place your speech audio files anywhere. AC will refer to them by Addressable key.

    The Manual's "Speech audio" chapter covers how to rely on Addressables instead of Resources.

  • Ok, I have followed the manuals guide, moved the speech folder fro, AC resources into my wider games folder, imported the Addressables package and added the scripting define symbol, but it isn't working, anything else I am missing? The console says 'Audio file 'Resources/Speech/Player/Player464' not found in Resources folder.'

  • You must set your Reference speech files field to By Addressable, and then set your speech audio file keys to match the expected name listed in the Speech Manager - this'll be the same name as their filenames when using Resources folders.

    If you're unfamiliar with Unity's how Addressables system works, see Unity's docs on it beforehand.

  • Hi, so I have read through the documentation, followed some steps but my speech is not being loaded. See screenshots here:

    Should I be using a script to load the addressable?

  • edited November 2022

    I also remember this scene loading lag happening after I updated my unity or AC version in the summer FYI

  • I tried to switch to addressables as well, but I guess I would need to update my AC version for this (what I don't want to do 3 weeks before release).

    I got this compile error: Assets\AdventureCreator\Scripts\Game engine\SceneInfo.cs(190,16): error CS1061: 'AsyncOperationHandle' does not contain a definition for 'WaitForCompletion' and no accessible extension method 'WaitForCompletion' accepting a first argument of type 'AsyncOperationHandle' could be found (are you missing a using directive or an assembly reference?)

    Seems the interface of the Adressable-PlugIn changed in the meanwhile.

  • @jamesfootlight: Again, you need to rename your Addressable keys to match the expected name as listed in the Speech Manager. For example, the key for the line Player123 should be named Player123.

    @KaiB: It may be a case of updating the Addressable package rather then AC. What are your exact version numbers for AC, Unity, and your Addressables package?

  • edited November 2022

    ok so the keys are identical (without the .mp3) but I get this error:

    Unable to open archive file: /Users/jlightfoot001/Dropbox/TMOWM FINAL FILES/The Mystery Of Woolley Mountain - Original/Assets/StreamingAssets/speechassetbundle

    and this:

    Failed to load AssetBundle '/Users/jlightfoot001/Dropbox/TMOWM FINAL FILES/The Mystery Of Woolley Mountain - Original/Assets/StreamingAssets/speechassetbundle'

    and this

    Cannot load audio file 'Player6176' from AssetBundle as no AssetBundle is currently loaded.

    see screenshots:

  • Is this in the Editor, or builds?

    In builds, you need to build your Addressble package - see Unity's docs on the topic here.

  • edited November 2022

    This is in the editor. I am trying to test the speed of loading scenes using addressables. Current;y the speech isn't playing due to the above errors

  • edited November 2022

    So I could resove the compile error (by using a newer Adressable package version), and I encountered also the problem as jamesfootlight.
    The problem was for me, that the adressabels had "Speech/" as a prefix.
    I solved it by clicking the "Simplify ..." Command in the dropdown shown below.
    Then the "Speech/" was removed from all adresses and my voice audio worked.
    Might be worth a try.


  • @KaiB Would you mind walking me through how you did it and maybe taking a look at my set up? Would you be up for a zoom? I would very much appreciate it! I feel I am almost there but obvs doing something wrong! I have simplified my names too

  • I keep getting the unable to open archive file and failed to read data for my assetbundle errors

  • Hmm... I don't know, if I'm much of help here, as I did not had those last issues you are reporting. I also very new to this topic.
    Have you tried a different path? Maybe there is a hiccup with the special chars?
    "The Mystery Of Woolley Mountain - Original".

    Have you changed anything in the Addressable settings? I'M wondering that the error states an "archive".
    Have you "build" the addressable database?

  • is your speech set to addressables or asset bundle?
  • edited November 2022

    I marked all 3000 mp3s in the speech folder and clicked in the inspector the addressable checkbox. Then I was prompted a message box that I confirmed. After that it moved them all out and added it to the database.
    In the Speech Manager have choosen "Reference speech files: By Adressable"

  • ok and did you do anything with the addressables window? Did you drag them in there? How did you name the asset bundle they should be in? and where is your asset bundle in your folders? did you use the script from unity to build it?

  • I used the build-drop down/button in the addressable window. After "Tools" there is a lot of space, on the right side there you can find "build"
    No, I haven't changed anything else so far and I have no idea what name is used for the bundle and where it is stored.

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.