Search Unity

Bug Materials don't load properly when using "Use Existing Build" play mode script

Discussion in 'Addressables' started by tomkail2, Sep 6, 2021.

  1. tomkail2

    tomkail2

    Joined:
    Jul 22, 2011
    Posts:
    25
    Hi there! We're finding that "Use Existing Build" isn't loading materials properly on WebGL.
    The scene shown here ("Home") is hosted on a server and loaded via Addressables - but the sprite materials (as well as a particle system and another custom shader) are all showing with the default pink "broken shader" color.

    You'll notice that there's a warning stating "Material does not have a _MainTex texture property" and some errors (Assertion failed on expression: 'request.key.guid.IsValid()') spamming the log (these only show when the material inspector is expanded).

    These errors can be fixed by removing and re-adding the material, or changing the shader back and forth - but obviously this means it's no longer using the downloaded material!

    Should we assume this is covered by the warning "Asset bundles built with build target WebGL may not be compatible with running in the Editor."?

    upload_2021-9-6_9-4-39.png
     
    Last edited: Sep 6, 2021
  2. TreyK-47

    TreyK-47

    Unity Technologies

    Joined:
    Oct 22, 2019
    Posts:
    1,822
  3. zap7

    zap7

    Joined:
    Oct 29, 2017
    Posts:
    2
    Was this ever resolved?? +1
     
  4. unity_krista

    unity_krista

    Unity Technologies

    Joined:
    Apr 28, 2020
    Posts:
    40
    The materials being pink is expected for running in Editor for non-Standalone platforms with Addressables. This is because different platforms have their own way of compiling those shaders. Does it load correctly in browser or on console?
     
    KamilCSPS likes this.
  5. KamilCSPS

    KamilCSPS

    Joined:
    May 21, 2020
    Posts:
    448
    After banging my head on this issue for a long time may I suggest you please add this to the documentation.

    For examples, loading addressable scenes in WebGL + URP is basically impossible in this mode.
     
  6. CeleDko

    CeleDko

    Joined:
    Jan 15, 2017
    Posts:
    27
    So is there any way to solve this problem?