Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Shared textures are included in the build?

Discussion in 'Scripting' started by Dextozz, Sep 30, 2019.

  1. Dextozz

    Dextozz

    Joined:
    Apr 8, 2018
    Posts:
    493
    I'm using Asset Bundles to reduce app size:

    ModelA_AssetBundle
    ModelB_AssetBundle
    SharedTextures_AssetBundle

    (Where modelA_AssetBundle contains a 3D model, prefab, materials, and textures related only to a single model. modelB_AssetBundle contains the same but only related to a different model. SharedTextures_AssetBundle contains textures that both models and prefabs from these two asset bundles share)

    Now, anything assigned to ModelA_AssetBundle and ModelB_AssetBundle is omitted from the build (as is the usual case with asset bundle). However, none of the SharedTextures_AssetBundle info is omitted. Any idea what's happening here?
     
  2. palex-nx

    palex-nx

    Joined:
    Jul 23, 2018
    Posts:
    1,748
    Probably misconfiguration? I have shared bundle with ui sprites and multiple prefab using them and they're ommitted in build and included in bundle.
     
  3. nilsdr

    nilsdr

    Joined:
    Oct 24, 2017
    Posts:
    374
    Does the manifest say modelA and B depend on sharedtextures?

    Are the files in sharedtextures directly reference from a non-assetbundle asset anywhere?
     
    palex-nx likes this.
  4. Dextozz

    Dextozz

    Joined:
    Apr 8, 2018
    Posts:
    493
    I can't really check if those textures are referenced anywhere. I did a manual check in my scenes, didn't find anything. I used the asset usage detector asset (https://forum.unity.com/threads/ass...rences-to-an-asset-object-open-source.408134/) to help me out. It said that they were only referenced to materials in my project folder. Those materials are a part of an asset bundle.

    I didn't check for dependencies though. I'll check it out and get back. I don't see why it would stop them from being omitted though.
     
  5. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,514
    You kinda gotta go all the way down the rabbit hole... are any of those materials referenced anywhere, even in a disabled object somewhere in a legacy prefab or some scene?
     
    Dextozz likes this.
  6. nilsdr

    nilsdr

    Joined:
    Oct 24, 2017
    Posts:
    374
    duplicate the textures and make your assetbundle reference the duplicates, are the duplicates omited from the build?

    remove the originals, if something breaks you had a direct reference somewhere :p
     
    Dextozz and Kurt-Dekker like this.
  7. Dextozz

    Dextozz

    Joined:
    Apr 8, 2018
    Posts:
    493
    Thanks, guys. I found the issue.
     
    Kurt-Dekker likes this.