Search Unity

Wrong texture loaded from AssetBundle

Discussion in 'Asset Bundles' started by svizcay, Oct 11, 2018.

  1. svizcay

    svizcay

    Joined:
    Oct 26, 2015
    Posts:
    28
    Hi, I have a dataset of ~1200 images of 2048x1024 that I'm importing into the project using AssetBundles.
    I packed the dataset in 3 bundles (part1, part2 and part3).

    When I load the Texture2D with LoadAsset<Texture2D>(imgId), I don't always get the right image (I get instead the content of a different image id). This happens running the project in the editor (2017.2.1f1). Of course names are not duplicated when I created the bundles.

    I had a similar problem when I was using the Resources folder to store all those images. After building the project the generated archive with the assets was over 4GB and reading textures from it sometimes returned back the wrong images.
    https://forum.unity.com/threads/bug-4gb-limit-to-textures-in-standalone-build.441116/
    I mention this because the problem looks similar, but now I'm using AssetBundles, which are not supposed to have that problem and I also make sure each bundle doesn't weight more than 2GB

    Any reason why I'm getting the wrong texture loaded.
    Thanks
     
  2. svizcay

    svizcay

    Joined:
    Oct 26, 2015
    Posts:
    28
    I stopped having that problem by reducing the number of images within each bundle.
    So, is there at the end any limit about the size of the bundle file to be correctly read?