WebGL 1 build of the sample URP scene with Unity 2022.1 results to a black screen

Hi, after an Unity upgrade from 2021.3 to 2022.1 (and a URP upgrade to 13.1.8) we’ve experienced an avalanche of errors in the console for our WebGL 1 build of the kind: WebGL-1.framework.js:1796 Texture creation failed. 'ShadowAuto' is not supported for Render usage on this platform. Use 'SystemInfo.IsFormatSupported' C# API to check format support. Nothing in the scene renders, just the UI. This doesn’t happen for WebGL 2 or all the other platforms we support. After trying to build the URP sample scene for WebGL1 we have the same result. This thread WebGL builds for mobile page-2 also mentions that Unity 2022.1 breaks WebGL1 builds. We’ve filed issue IN-20627 in the issue system. Here’s a snippet of an unmangled console log:

$Debug_LogError_m94F967AB31244EACE68C3BE1DD85B69ED3334C0E @ WebGL-1.wasm:0x18163e4
$Texture_ValidateFormat_m1BC113E81713CBAF60BCA4D022ACC0C6B239E740 @ WebGL-1.wasm:0x18214b8
$RenderTexture_Initialize_m924B8245CB23DF4FECCF5A68B158A393DC0401D0 @ WebGL-1.wasm:0x1824aa2
$RenderTexture__ctor_m68A1B9CAA1BE0B597C5F4895C296E21502D0C962 @ WebGL-1.wasm:0x1824a58
$RTHandleSystem_Alloc_mE4723721DA30875086781955663AA33310B95AA8 @ WebGL-1.wasm:0x51dc8a
$RTHandles_Alloc_m609B770F97077DE8AB205E51E4631DD571C9E82F @ WebGL-1.wasm:0x52afda
$ShadowUtils_AllocShadowRT_mAAC8080F3EF597282FB885BFBFF8E64940219031 @ WebGL-1.wasm:0x6ca276
$MainLightShadowCasterPass__ctor_mB767B87419FA7EFB05B3BEBA5507AB59C14A3A51 @ WebGL-1.wasm:0x6a1871
$UniversalRenderer__ctor_m856C52B21917B447D20A4ADED117BFCB71E0BD47 @ WebGL-1.wasm:0x6a63c7
$UniversalRendererData_Create_m3E493AD519F2799F19CA3B3612243509AD2F9E8E @ WebGL-1.wasm:0x6aa770
$UniversalRenderPipelineAsset_CreateRenderers_mA8440293F4D2781FB71D9C8515ED5C911EB99B9A @ WebGL-1.wasm:0x715742
$UniversalRenderPipelineAsset_CreatePipeline_m2F69EDC983B5525F058693339A12B2595B5251A6 @ WebGL-1.wasm:0x71557f

Maybe something in the shadowmap RT setup in the new RTHandleSystem is the culprit? We see that RTHandleSystem creates a render texture with the RenderTexture.Shadowmap format (which we checked is supported for WebGL 1) but then we enter the RenderTexture constructor and this is native so we can’t find what really happens. Seems that somewhere internally the GraphicsFormat.ShadowAuto format appears in the picture, which breaks stuff for WebGL 1. Do you know if it’s possible to hotfix this in some way?

We know WebGL 1 is about to get removed but we plan on supporting it to the last moment because we historically have a significant user base on the Mac ecosystem. Also the sticky post points that the Unity version for WebGL 1 removal is 2023.1 and for 2022.1 it should still be supported.

Hey! we are aware of this issue (introduced in 2022.1) and are currently working to fix this. Will keep you posted for when the fix and backports land.

As you mentioned, WebGL 1 support is being removed in 2023.1, so we do recommend targeting WebGL2 moving forward.