Search Unity

Analyze reports duplicate dependencies even with only one group

Discussion in 'Addressables' started by aferon, Nov 29, 2018.

  1. aferon

    aferon

    Joined:
    Jun 12, 2015
    Posts:
    8
    Hello.

    So I have setup Addressables (0.4.8) and kept the default settings it creates when you first initialize it.
    After throwing a decent number of prefabs I want to access through
    AssetReference
    s in the Default Local Group I hit the Analyze / Run tests button. This results with many duplicate dependencies.

    As I understand it (I never really used asset bundles up until now), you'll get duplicates dependencies if you put different assets that share a same dependency in different asset bundles.
    If that's the case, why am I getting these results when all my prefabs are in a single group that's configured with the Pack Together bundle mode?

    At first I thought that's because the dependencies might also be found in the built in data (scenes declared in the build settings and/or assets in Resources folders), so I removed every scene from the build settings and made sure no Resources folder was preset in the project.
    Rerunning the tests then yields the same results. Am I missing something?

    This also brings me a feature request: a new window that lists all assets, dependencies included, that are going to be added to each bundle.
    I guess I can get a similar feature with the soon-to-be-deprecated Asset Bundle Browser, but if I'm not mistaken that requires bundles to be actually built. Since the Analyze button prepares a bundle building process without actually triggering it we could leverage this to get proper inspection tools.

    And a bonus question: is it possible to prevent some dependencies to be pulled in a bundle and keep them in the player built in data?
    Bundle noob here, I'll accept answers like "that's not possible, asset bundles don't work that way".

    Thanks.
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    ok, to the three things...

    1. the dependencies. There are two possible reasons for this. One, we have a bug in our code. Two, you have prefabs and scenes in that group. Scenes and non-scenes are not built together in bundles (don't ask me why). So if your group has both prefabs and scenes in it, you'll end up with two bundles at a minimum, which could lead to duplicated assets.
    2. feature request: we actually had that for a little while, but it produced a ton of data that was hard to consume in a useful way. We are working on bringing it back once we can figure out a clean way to do it.
    3. bonus. no, bundles are unaware of what's in the player build. so if you put some texture in resources, and a prefab in addressables referenced the texture, you'd get two copies of it.
     
  3. aferon

    aferon

    Joined:
    Jun 12, 2015
    Posts:
    8
    Thank you for your answers.
    About the duplicated dependencies: no, I don't have scenes in that group, only prefabs. There are direct references all over the place though. I'll have to draw a map of them someday, I'm pretty sure it'll come up as some monstrosity.
    That might also be of interest: clicking the Fix All button creates a new group with some dependencies, but it keeps finding more duplicates afterwards. I have to fix all three or four times to get rid of all duplicates.
     
  4. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    If possible, it would be nice if you could could create an actual Unity bug report, attach your project, then link it here. Then we could repro the situation locally and get to the bottom of it.
     
  5. aferon

    aferon

    Joined:
    Jun 12, 2015
    Posts:
    8
    I'll try to reproduce it with a minimal setup and I'll then create a bug report. My project is a bit too large to be uploaded as-is.
    For now I'm even able to get the issue only with a single prefab in a single group.
     
  6. aferon

    aferon

    Joined:
    Jun 12, 2015
    Posts:
    8
    Bug created: 1108858
    This replicates quite easily when an asset marked as addressable references another asset which isn't.
     
    MNNoxMortem likes this.
  7. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Thanks for the bug report. We'll investigate.
     
    MNNoxMortem likes this.
  8. isaac-ashdown

    isaac-ashdown

    Joined:
    Jan 30, 2019
    Posts:
    69
    Hi - I'm also getting a problem similar to the OP: my project has a single addressables group, containing only prefabs, and the 'check duplicates' shows many hits. Fixing it creates a new group and then after that there are no more hits.

    It does appear to have an impact though: before, i have one bundle that's around 600MB, but after I have two bundles of only around 60MB each.

    Was there any update on the reported bug?

    Edit: I realised that the created DuplicateAssetIsolation group has compression on ,which accounted for the size difference. If I disable it, the size of the newly created seperate bundle is the same as when I had just the one bundle.
     
    Last edited: Sep 16, 2019