Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

Asset Bundle Dependency Question

Discussion in 'Editor & General Support' started by Jarhead, Mar 26, 2012.

  1. Jarhead

    Jarhead

    Joined:
    Jul 4, 2009
    Posts:
    38
    I had a quick asset bundle question, using the following pseudo code as a reference


    BuildPipeline.PushAssetDependencies();

    StartLoop1
    BuildPipeline.BuildAssetBundle(...);
    EndLoop1

    BuildPipeline.PushAssetDependencies();

    StartLoop2
    BuildPipeline.BuildAssetBundle(...);
    EndLoop2

    BuildPipeline.PopAssetDependencies();

    BuildPipeline.PopAssetDependencies();

    So the basic idea is that i have 2 groups of asset bundles that need to be built. Only a subset of asset bundles being built in loop2 have dependencies on assets being building in loop1. So my question is will an asset bundle in loop2 have "dependency info" built in to it even though it has no dependencies on assets in loop1? Would there be other side effects to this approach?

    Using this approach will help keep my build system more simple rather than tracking how every bundle is related. The game already has a mechanism to deal with dependencies because it checks to see if all dependencies for a resource group are loaded before loading the main asset. However, the build system builds groups of asset bundles and only knows about dependencies in the group it's currently processing. This creates problems if an asset bundle is shared across multiple resource groups. When processing a resource group, if a dependent asset was already built when a previous resource group was processed, it's too late to include it's dependencies in the current resource group. So it seems easier to load all level 1 assets, push dependencies, load all level 2 assets push dependencies, load all level 3 assets, push dependencies, etc..