Search Unity

Building addressables for multiple platforms

Discussion in 'Unity Cloud Content Delivery' started by jctalespin, Jan 21, 2021.

  1. jctalespin

    jctalespin

    Joined:
    Oct 25, 2018
    Posts:
    9
    Hello, I've run into an issue with my shaders loading from addressables that I havent been able to troubleshoot.

    I first created an addressable asset targeting StandaloneWindows64, uploaded the asset to Unity CCD. I then loaded the addressable assets in a separate project using the catalog created without issues. The asset was set as an addressable, but the shaders referenced in the materials were not set as addressable.

    I then switched platforms to Android to build the same asset for Android and added it to Unity CCD. This time when I tried loading the same addressable asset, targeting either Android or StandAloneWindows, the asset is loaded, but the shaders reference is broken (pink texture). Note: Catalog json from the StandaloneWindows64 and Android builds were included the project when trying to load the assets in the separate project.

    Any clues/suggestions as to why this is occurring? Is my process of building addressable assets for multiple platforms incorrect?
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    When you enter play mode in the editor, the editor looks at the current build target and plays in that context. If your build target is Android, it will be in play mode as if it were running on an Android. This means any
    #if
    blocks that are specific to android or windows will be treated accordingly. Similarly, this means Addressables will attempt to run based on the current platform-specific information. If your editor is set to Android build target, and you are loading bundles, it will try to load Android bundles.

    This won't work well though, because shaders compiled for Android hardware won't render on Windows hardware. So if you want to run your game in the editor against real, built content, most of the time you'll need to set the editor to be on the standalone platform. The exception is if you are just trying to debug something Android specific and are ok with pink textures.
     
  3. jctalespin

    jctalespin

    Joined:
    Oct 25, 2018
    Posts:
    9
    Yup, thats definitely the cause of the issue. Unfortunately we have to test the addressables being loaded targeting Android platform in Editor because we are testing Oculus Quest assets using Oculus Link, so we cant switch to StandAlone for debugging.

    Since we have to target Android in Editor for testing the Quest, any suggestions for a work around to rendering the Android shaders in Editor? I've searched in the forums and saw some mentions about assetbundles, but am not sure if they would work with the Addressable system.