Search Unity

Bug - Materials in asset bundles lose references to their textures / OSX + iOS

Discussion in 'Editor & General Support' started by DanSuperGP, Aug 27, 2015.

  1. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    Pinging @Vincent Zhang on this, because I know he is the master of the asset bundles.

    We've encountered a major bug involving Materials packed into asset bundles. When a prefab is loaded from an asset bundle where the material and the texture for that material is also packed into the bundle, the material will lose the reference to it's texture. This leads to all of the particle systems in our project showing only white squares when they are loaded from an asset bundle.



    I've made a simple test project that demonstrates this issue. It is (Case 723031) Materials packed into asset bundles lose texture references
     
  2. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    Bump... because this is important
     
  3. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    Bump again...
     
  4. darcyrayner

    darcyrayner

    Joined:
    Jun 20, 2013
    Posts:
    6
    I'm seeing this as well. Pretty annoying, because all the new asset bundles stuff is working beautifully otherwise.
     
  5. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    Yeah, they marked my test project bug report as "known issue" so hopefully we'll see this fixed soon
     
  6. Deleted User

    Deleted User

    Guest

    Sorry for the late reply. Haven't gotten email notification...

    Will have a look in the recent days.
     
  7. Deleted User

    Deleted User

    Guest

    Looked into it 723031. You hit the limitation of current sprite packing system...

    The thing is if sprite packing is enabled, we will only add the atlas into the AssetBundle without adding the original texture, to remove duplication.

    In your case, you add the explosion_star_02 & paw_particle_effect sprites to the AssetBundle with sprite packer enabled. So the original textures are stripped. But the material used by particle system still use the original textures.

    I agree we should be smarter to detect if the original textures are referenced directly or not, but we have this kind of limitation in our system since there is no fast way to track who is referencing an asset so far.

    So the workaround is
    1. Either you don't add the two sprites into the AssetBundle(then in your case, only the original textures will be added to the AssetBundle instead of the atlas)
    2. Or don't reference the original texture of a sprite...

    We will definitely fix this limitation, it's on our to-do list.

     
    Last edited by a moderator: Sep 6, 2015
    DanSuperGP likes this.
  8. DanSuperGP

    DanSuperGP

    Joined:
    Apr 7, 2013
    Posts:
    408
    Cool, we can definitely make it a policy to keep particle textures out of the sprite packer for now. Thanks a bunch.