Search Unity

[solved] Texture map Metallic is missing when importing from asset bundle

Discussion in 'Asset Bundles' started by trnq1ll0, Jan 15, 2020.

  1. trnq1ll0

    trnq1ll0

    Joined:
    Aug 30, 2019
    Posts:
    48
    Hi there,

    i'am on Unity 2019.3 and i have an fbx with albedo, normal and metallic map. It looks all fine if the fxb is imported and the maps reassigned correct.

    But after building* an asset bundle from it, load the bundle, get the model from the bundle and Instantiate() it, the metallic map is gone.

    What is the problem and how to fix it?

    Related question, how to examine the complete content of the asset, including materials & textures? To see if its left to include on building.

    Thanks

    (*)
    Code (CSharp):
    1. BuildPipeline.BuildAssetBundles(path + "\\iOS", BuildAssetBundleOptions.StrictMode, BuildTarget.iOS);
     
    Last edited: Jan 16, 2020
  2. Neto_Kokku

    Neto_Kokku

    Joined:
    Feb 15, 2018
    Posts:
    1,751
    The shader variant that uses the metallic map didn't get compiled in. If it's a standard Unity material, you need to add it to the "always included shaders" list in the project graphics settings.
     
  3. trnq1ll0

    trnq1ll0

    Joined:
    Aug 30, 2019
    Posts:
    48
    Good point, but I only use standard shaders. And the only shader I've written myself is already in this list.

    But the problem is solved by simply clearing the cache before creating the asset:
    Caching.ClearCache();