(URP) Addressable materials/shaders is black (shaders not included or not loading?)

Hi,

I have a main project and content project with addressables. For some reason when I load Addressable content, the materials is pitch black. This happens in the editor and the built versions.

I tried manually including the shader and the material in the Addressable groups AND even included them in the main project (even though you do not need to do this).

Looks like either the shaders are not included, or not loading. Is there a way to check this?

Everything else, meshes, textures, scenes and material itself, seem to load just fine.

Thanks!



I tried a simple cube with built in material/shader, same thing. Any ideas? :frowning:

If I do this (obviously) it works
go.GetComponent<Renderer>().material.shader=Shader.Find("Universal Render Pipeline/Lit");

So, from further research this only seem top happen with URP shaders only. If I were to make a simple unlit shader and add that to the bundle, that seem to show up ok.

I could not figure this out, but it turned out it was specific to that project, I created a new project and did not have this problem. If anyone know what may have happened please share.

Hey, I have the extact same problem. I’ve tried building to windows and android.

With android, for some reason, that dodgy hack with reassigning the shader does not work.

What I did end up finding out is that if I just added a default cube object with the same shader it made the shaders show up. Which is weird because when I remove the cube the shaders continue to work with the build, until they dont then I have to add the cube back into the scene and it works again, for awhile???

My scene is completely empty except for the script which handles the spawning of the addressable objects

Yeah, it is weird, in my case it was a new project and it was mostly empty too. Not even a cube would worw.

Conclusion I came to was that there may have been something wrong with the addressable files (Unity’s). Corrupt file or config maybe. Creating a new project fixed it.

Hi all, any chance you have shader stripping enabled? By default, Unity strips shaders variants that are not used in scenes. This can exclude variants that are only used in AssetBundles. https://docs.unity3d.com/Packages/com.unity.addressables@1.21/manual/ManagingAssets.html#shaders

1 Like

I’m running into this issue in Unity 2023 with URP also where materials are turning black for some reason. I’m thinking some files got corrupted and I’m not sure how to fix it. Reimport does nothing. Reassigning textures doesn’t fix it, nor did changing to a different URP shader

9234042--1290033--B63A3E94-2F7B-407B-BB27-DEEE439F1B91.gif

Edit: Going to file in the file explorer and deleting all associated meta data fixed this for me