Materials loaded from asset bundles are mangeta (regression in 0.6.2)

Materials are magenta when loading then from asset bundles in 0.6.2. This was not the case in 0.5.0.

I have scene A with a blue sphere in it (a shadergraph which just has colour exposed). Then I load scene B with the same sphere with a material that uses the same shader.

In polyspatial 0.5.0 this worked (image 1) whereas in 0.6.2 the material loaded from scene B is rendered as magenta.


1 Like

I’m running into the same problem where materials loaded through addressables are displayed in pink. I’m using the latest package (0.6.2) but didn’t test with previous versions.

I’m surprised it worked in 0.5.0! Loading shader graphs from asset bundles/addressables isn’t currently supported; it’s on our road map, but I don’t currently have a time line for it.

Non-shader graph materials (URP/Lit, etc.) should be loadable from addressable/asset bundles, however.

1 Like

I don’t have any Shader Graphs on my project, so I’m using the URP Simple Lit shader and I still get pink on the simulator

If you submit a bug report with a repro case and let me know the incident number (IN-#####), I can take a look.

We are following the workaround from this thread Material conversion fails when loading scene from asset bundle - #3 by kapolka

which placed meshes with these shaders into the first scene and then when loaded, even from asset bundles they’d work (I assume because realitykit already has a copy of the shader in its system). This worked for us for shadergraph shaders (never worked for the built-in shaders) until 0.6.2 where it now works for builtin shaders and NOT shadergraph shaders.

OK, that makes sense; thanks for the extra information. I think this change happened because we used to map shader graphs by name (which would be the same for the shader graphs in the asset bundles), but switched to mapping them by instance ID (in part because names aren’t guaranteed to be unique).

Although it’s not the same as full support for shader graphs in asset bundles, I think we can put a fix for this issue in a subsequent release: we will fall back to mapping shader graphs by name as we do for built-in shaders if there’s no match by instance ID, and include all the shader graph MaterialX exports in the project in the build (mapped by name). That way, as long as your shader graphs have unique names and are in the base build, they will be loaded correctly when used in asset bundles (though the actual MaterialX file still won’t be loaded from the asset bundle, so you still can’t use shader graphs that weren’t included in the base build).

Sorry we broke this workaround! Hopefully we can get this fix into the next bugfix release and that will work for you.

@kapolka can you confirm if the fix was included in the 0.6.3 release please? It doesn’t appear to be from my quick testing.

1 Like

No; it didn’t make it in, but we’ll get it in the next one.

1 Like

is there any ETA on the next release that fixes this issue?

Knowing a rough ETA would help us as well. If it is planned for some time in December at least, we can plan on using this workaround. If not, then we will need to change how we are loading things.

No specific ETA, but we are hoping to get one out this month.