Forum rules - please read before posting.

Asset bundle for every scene/chapter of the game

We recently updated to v1.66 and stumbled upon the AssetBundle feature for audio files. Thanks for that!

I was wondering if it would be efficient to utilize AssetBundles to store audio files for every scene or a chapter of the game. Reason being that if for example a game had only one language, there would be only one AssetBundle(for every language), which, from what I can tell, is almost same as storing files in the Resources folder.

Maybe I just misinterpreted the usage of AssetBundles, but I just wanted to get this off my mind :)

Comments

  • edited March 2019

    if for example a game had only one language, there would be only one AssetBundle(for every language), which, from what I can tell, is almost same as storing files in the Resources folder.

    I'm not sure this is quite true, at least so far as loading times go - since the methods of retrieval/storage are different. Even when only one language is involved, storing audio in an AssetBundle should be more performant than in Resources - so far as my testing and understanding of the docs go, at least.

    I was wondering if it would be efficient to utilize AssetBundles to store audio files for every scene or a chapter of the game.

    What constitutes as correct for a given scene/chapter isn't something that AC can automate, since asset files / speech that can play across scenes etc also have to be accounted for.

    You can, however, assign the loaded asset bundle through script. If you leave the provided AssetBundle name field blank, you can assign it manually with:

    AC.KickStarter.runtimeLanguages.CurrentAudioAssetBundle = myAssetBundle;
    
  • Thank you for your quick answer. I did jump too quickly to conclusions regarding the single AssetBundle perfomance, sorry for that.

    Manually assigning AssetBundles sounds like something, that would have to be bulletproof, but I will think about it.
    Since loading AssetBundles can cause memory spikes I assume it would have to be done between scene switching/loading screens.
    Do you think that it's worth trying out? Out game will be released on mobile platforms aswell which will limit available memory for audio files (there are hundreds).

  • edited March 2019

    I'd see what performance is like without resorting to that first, personally.

    Bundles can be loaded in asynchronously via a coroutine:

    IEnumerator LoadAssetBundleCoroutine (string filename)
    {
        string bundlePath = Path.Combine (Application.streamingAssetsPath, filename);
        var bundleLoadRequest = AssetBundle.LoadFromFileAsync (bundlePath);
        yield return bundleLoadRequest;
        AC.KickStarter.runtimeLanguages.CurrentLipsyncAssetBundle = bundleLoadRequest.assetBundle;
    }
    
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.