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

Pinging @ 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

Bump… because this is important

Bump again…

I’m seeing this as well. Pretty annoying, because all the new asset bundles stuff is working beautifully otherwise.

Yeah, they marked my test project bug report as “known issue” so hopefully we’ll see this fixed soon

Sorry for the late reply. Haven’t gotten email notification…

Will have a look in the recent days.

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.

1 Like

Cool, we can definitely make it a policy to keep particle textures out of the sprite packer for now. Thanks a bunch.