Search Unity

Runtime load from AssetBundle freeze the game

Discussion in 'Asset Bundles' started by Epicasso, Jan 22, 2020.

  1. Epicasso

    Epicasso

    Joined:
    Sep 1, 2017
    Posts:
    1
    Hi,

    I have an issue with loading my mobs prefabs from asset bundles. When I am loading a mob - game is freezing for 0.5 sec. Is there any way I can optimize it, so user will not feel freezes?

    Here is how the asset bundle was created:
    Code (CSharp):
    1. BuildPipeline.BuildAssetBundles("AssetBundles", BuildAssetBundleOptions.ChunkBasedCompression, EditorUserBuildSettings.activeBuildTarget);
    Here is a profiler screenshot. All the 15fps drops are asset bundles loads.

    Unity_SuTPFOqBBn.png
     
  2. KokkuHub

    KokkuHub

    Joined:
    Feb 15, 2018
    Posts:
    143
    Show your loading code.
     
  3. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    2,211
    Load them in non-performance critical context. E.g. on scene load. Or make a loading screen.

    There's no way around it, other than making bundle more "lightweight", or by shifting loading time.

    Just make sure that you're not loading contents from the bundle multiple times.
     
unityunity