Search Unity

WebGL Addressable Shader Issues

Discussion in 'Addressables' started by ECS_Justin, Sep 27, 2019.

  1. ECS_Justin

    ECS_Justin

    Joined:
    Dec 5, 2011
    Posts:
    12
    I'm having an issue with loading an Addressable asset in WebGL. When the asset gets loaded it appears as though something is wrong with the shader it uses. Looking at the image below, the prop asset is assigned as an Addressable. I build the player content with my platform set as WebGL. I then do a simple
    Addressables.InstantiateAsync( "Prop" );
    and it will load the asset as it appears on the right. To me it seems as if the correct shader variant isn't being assigned. If I do something along the lines of:

    Code (CSharp):
    1.  private IEnumerator Load()
    2.     {
    3.         AsyncOperationHandle<GameObject> operation = Addressables.InstantiateAsync( "Prop" );
    4.  
    5.         while( operation.IsDone == false )
    6.         {
    7.             yield return null;
    8.         }
    9.  
    10.         yield return new WaitForSeconds( 2.0f );
    11.  
    12.         Material propMaterial = operation.Result.GetComponent<Renderer>( ).sharedMaterial;
    13.         propMaterial.shader = Shader.Find( propMaterial.shader.name );
    14.  
    15.         yield return null;
    16.     }
    it fixes the issue but I certainly don't want to do this every time I load an asset. This problem exists both in the editor and in a build. Any ideas or suggestions?

    upload_2019-9-27_13-57-15.png
     
  2. ECS_Justin

    ECS_Justin

    Joined:
    Dec 5, 2011
    Posts:
    12