Search Unity

Missing shader reference when load addressable bundle on Windows

Discussion in 'Addressables' started by homatsu, Jan 29, 2020.

  1. homatsu

    homatsu

    Joined:
    Jan 29, 2020
    Posts:
    2
    Hello,
    Now I have problem:

    ## Description:
    When load the addressable bundle which is created on Unity Editor Linux in a Docker container on Unity Editor Windows, the shader reference is missing, and the color of the Cube turns pink.

    ## Environment:
    - Unity 2019.2.12f1 (Linux, Windows)
    - Addressables Version 1.5.0

    ## To reproduce:
    1. Create a Unity project which contains Addressables package

    2. Create a cube and set a Material, and create a prefab

    3. Add the prefab, material and shader to the AddressablesGroups
    AddressablesGroups.jpg

    4. Build a Docker image which contains the Unity project, and run the container
    (run on LinuxOS)

    5. Create a bundle with the following command:
    `/opt/Unity/Editor/Unity -batchmode -nographics -projectPath AssetbundleBuild -executeMethod UnityEditor.AddressableAssets.Settings.AddressableAssetSettings.BuildPlayerContent`

    6. Copy the bundle and the content catalog file to local pc

    7. Create a Unity project on Unity Editor Windows to load the bundle

    8. Load the content catalog file and instantiate the asset
    - Addressables.LoadContentCatalogAsync({Path to the content catalog file})
    - Addressables.InstantiateAsync("Assets/Prefabs/Cube.prefab")

    9. The shader reference on the cube is missing
    InstantiateAsset.jpg


    Could you tell me how to load the bundle keeping the shader reference?


    Attached:
    - Content catalog: catalog_2020.01.24.12.41.40.json
    - Addressable bundle: bundle_assets_all_cd74db0e4125a817522b421b47d4504f.bundle
     

    Attached Files:

  2. Patrick_PS

    Patrick_PS

    Joined:
    Sep 9, 2019
    Posts:
    154
    So you build the bundles on a linux PC using the "pc, mac & linux standalone" built target and then get the error when using the bundle on a windows PC?

    In general, the bundles are build for the target that is specified in build settings and will not work correctly on another device even in the editor.
     
  3. Jaimi

    Jaimi

    Joined:
    Jan 10, 2009
    Posts:
    6,208
    This happens to me also (but built on Windows, run on windows). UMA creates a duplicate material inherently in its process, so in this process, I simply looked up the shader when instantiating the material from the bundle, and copied the shader properties over.
     
  4. homatsu

    homatsu

    Joined:
    Jan 29, 2020
    Posts:
    2
    Thanks for your comment

    The current workaround is to keep the same Shader in the target project and set it to the material of the loaded asset.

    I think this problem is caused by building on LinuxOS,
    In my case, There were no problems with Windows to Windows.
     
    Last edited: Jan 31, 2020