- Home /
Shader not loading on addressable
I'm moving my addressable objects to a separate project and have hit a snag with loading custom shaders.
I load a custom ScriptableObject which has a Material on it, which in turn has a custom shader assigned. This worked fine when the SO was addressable on the main project, but it's not loading the shader when the addressables are built in another project. The SO and Mat load fine and show in the hierarchy, but the shader goes to the error shader:
Both projects have the shader set to always load, here are their Graphics Settings side-by-side:
I saw a similar question here but I don't use AssetBundle.UnloadAll or anything like that. And building this SO/Mat/Shader into a bundle in the game project loads it fine.
Both the game and the assets projects are Unity 2020.3.25.f1 and use Addressables 1.18.19
Help appreciated!
Answer by ThatRobVK · Feb 20 at 03:28 PM
OK I somehow managed to fix it, but the fix doesn't make sense to me, so still keen to figure out what is going on. Here are the steps I took and now it's loading both this shader and another shader correctly:
Make the shader itself addressable and put it in a separate addressables group
Rebuild addressables in the asset project
Rebuild addressables in the game project
Shader now loaded fine
Remove shader from addressables
Rebuild addressables in the asset project
Shader still loads fine
Add another material that requires a different custom shader in the asset project, rebuild addressables
Both shaders now load fine
So this makes no sense to me. Questions still in my head:
Adding the shader explicitly as an addressable item didn't seem to do anything as it still loaded after I rebuilt addressables - correct?
If it was rebuilding addressables on the game project that resolved it, then why did the second shader load fine without that rebuild? Also addressables on the game project isn't set to any of the paths the assets project builds to so they shouldn't have anything to do with one another anyway?
Why did the second shader load fine without being included in the always load shaders section of the Graphics Settings?
So it works, it's "fixed" but I don't actually understand which part of that fixed it and why, any comments appreciated to try to figure out so that people have a deterministic fix for this type of issue.
Your answer
![](https://koobas.hobune.stream/wayback/20220613053255im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Built in shaders not available in unity 3.3 2 Answers
How to modify the Default-Material ? 1 Answer
Error when importing certain assets packs (like water(pro)) 0 Answers
Converting c# function to shader. 0 Answers
downloading assets 0 Answers