Material conversion fails when loading scene from asset bundle

We are having issues with materials when loading scenes from asset bundles. All materials are pink and we get the following error in the logs:
Non shader graph shader 'Universal Render Pipeline/Lit' not supported or MaterialX encoding missing

Is it a known limitation that scenes can not be loaded from bundles when using PolySpatial? Does anyone know of a workaround?

We had a similar issue loading scenes using Addressables. We worked around this by placing a cube in our initial scene, using a material with the shader that was erroring.

This is the best workaround at present. We have support for shaders in asset bundles on our road map, but currently the only shaders that are included in builds are those directly referenced in the built scenes.

Do you really mean Shader Support for AssetBundles? Or do you mean Material support
Since as shown in this topic VisionOS Simulator Crash only in MR mode after loading simple model - visionOS Beta / Mixed Reality (Immersive) Apps - Unity Discussions

our materials are pink after loading models from assetbundles, but the shader (URP/Lit shader) is present in the scene at build time with an default cube.
Is there so far any workaround available?
Or should we open best here an bug report ticket?

Yes, please do this and let me know the incident number (IN-#####). We don’t currently test with asset bundles at all, so it’s not surprising that this doesn’t work at the moment, but it’s possible that we can at least add a workaround for this particular case.

we have reported the bug. Please let me know when you have a workaround available.

IN-58387

1 Like

Is there a workaround?

Using shader graphs in asset bundles (still) requires that the shader graphs be present in the base build (not just in the asset bundle–we can’t load them from asset bundles). When we don’t find a shader in the base build by asset ID (GUID), we fall back to matching by name (e.g., “Shader Graphs/Test”).

I have to manually reassign the shader to the materials, it doesn’t find the shaders automatically, if that’s what you mean

OK; looks like I was wrong about matching by name for shader graphs–we only do that for the standard shaders (like URP/Lit). If you submit a bug report with a repro case (and let us know the incident number: IN-#####), it would help us track and fix the issue.

1 Like

You can also fix it by adding the UI/Default shader (or any problematic shader) into the preloaded assets in your project settings. That fixed it for me.