How do I deal with the issue of Shared resources?

Issue #49 resolved
xiongjie created an issue

If gameobject A and gameobject B share the same resources (such as picture), how do I set bundle relationship?

Can you show me?

In fact, I want to know how to use "extract Shared assets" function

Comments (5)

  1. Hiroki Omae

    Hi @xiongjie,

    In Unity's asset bundle system, unless you explicitly declare assets are in certain asset bundle, all referencing assets goes into the asset bundle that contains asset which references that.

    In this example below I have created 2 asset bundles, bundle_0 and bundle_1. Only one prefab is explicitly assigned to these bundles (Prefab1, Prefab2) in graph. Prefab1 and Prefab2 references to its material(Mat1 and Mat2). Both materials reference the same texture (UnityChan_01).

    Here is how it is configured in asset bundle: bundle1.png

    bundle2.png

    Both bundle_0 and bundle_1 contains UnityChan_01, so if you load both bundles at the same time, you will be loading UnityChan_01 twice.

    If you want to create shared asset bundle between bundle_0 and bundle_1 and optimize your memory footprint, you can use Extract Shared Assets node like this.

    bundle3.png

    Extract Shared Assets will automatically find all dependent assets and create shared assetbundles, which, for this time shared_0 with only UnityChan_01.

    I hope this example is helpful.

  2. Log in to comment