Search Unity

LoadFromFile: Textures on Materials and Shaders missing

Discussion in 'Asset Bundles' started by Nikolasio, Oct 23, 2018.

  1. Nikolasio

    Nikolasio

    Joined:
    Dec 6, 2014
    Posts:
    59
    Hi,

    I'm creating my asset bundle for iOS via:
    Code (CSharp):
    1. BuildPipeline.BuildAssetBundles ("Assets/AssetBundles/iOS",
    2.     BuildAssetBundleOptions.ChunkBasedCompression,
    3.     BuildTarget.iOS);
    On certain moments in the game I'm instantiating asset bundle prefabs via:
    Code (CSharp):
    1. loadedAssetBundle = AssetBundle.LoadFromFile("Assets/.../AssetBundleName");
    Code (CSharp):
    1. AssetBundleManager.loadedAssetBundle.LoadAsset<GameObject>("prefabName");
    But on instantiation, the textures aren't used correctly by the shaders and materials. They're black or purple.

    I created one sprite atlas with all the textures used by the prefabs from the asset bundle. Do I need to do something with the shaders and materials used by the prefabs?

    There're two objects(characters) loading prefabs from the static 'loadedassetbundle'. Could that be an issue regarding to the textures missing?
     
  2. Nikolasio

    Nikolasio

    Joined:
    Dec 6, 2014
    Posts:
    59
unityunity