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 dependencies with Unity 5

Discussion in 'Editor & General Support' started by kork, Mar 5, 2015.

  1. kork

    kork

    Joined:
    Jul 14, 2009
    Posts:
    280
    I'm currently trying to figure out how I can manage asset dependencies for asset bundles in Unity 5. The "PushAssetDependencies" and "PopAssetDependencies" methods are deprecated now but I couldn't find a replacement for them. The documentation (http://docs.unity3d.com/Manual/managingassetdependencies.html) also just tells about the old way of doing it. Does anyone know how asset asset dependencies work in Unity 5?
     
  2. Anozireth

    Anozireth

    Joined:
    Feb 7, 2013
    Posts:
    71
    The way it works now is that you specify the bundle for each asset. Assume Object A and Object B are each assigned their own bundle, and that Object A depends on Object B. When building bundles, each will be in their own bundle (B will not be in A's bundle). Now suppose at runtime you want to load Object A. You use the manifest Unity generates to determine that Object B is a dependency of Object A. You load both Object A's bundle and Object B's bundle. Then you tell Unity to load Object A out of its bundle, and Unity will figure out that it needs Object B as well, and will load it from Object B's bundle and hook up the references between the two.

    I hope that makes sense. I would suggest this thread for more info on the new system:

    http://forum.unity3d.com/threads/new-assetbundle-build-system-in-unity-5-0.293975/

    And also the demo project from that thread:

    http://files.unity3d.com/vincent/assetbundle-demo/users_assetbundle-demo.zip
     
  3. kork

    kork

    Joined:
    Jul 14, 2009
    Posts:
    280
    @Anozireth thank you very much for pointing me into the right direction. Automatic dependencies rock :) I guess Unity should update the documentation then :).