Lightweight Shaders in Asset Bundle not loading properly
Hello,
I'm using Lightweight Render Pipeline in my project. And i'm loading scene from assetbundle. Shaders are not loading pink, but they are not behaving properly. I couldn't find those shaders in Always Included shaders in Graphics Settings.
I tried this code when scene loaded;
foreach (Renderer r in GameObject.FindObjectsOfType())
{
var material = Shader.Find(r.material.shader.name);
r.material.shader = null;
r.material.shader = material;
}
But it never answers.
I'm using Unity 2018.1.7f1
Could anyone help me ?
Thank you.
Answer by ceburakerol · Jul 20, 2018 at 12:03 PM
Finally i found a solution !
foreach (Renderer r in GameObject.FindObjectsOfType())
{
Material mat = new Material(Shader.Find(r.material.shader.name));
mat.CopyPropertiesFromMaterial(r.material);
r.material = mat;
}
it will crash in Unity 2018.2 when i load gameobject from assetbundle... and your solution work for me!! thank you
It still crashes for me, can someone help? @ceburakerol @RichLin
Your answer

Follow this Question
Related Questions
Hidden Post Fx Shader Not Working in Unity 5! 0 Answers
Audio Spatializer SDK. Source/Listener location matrix 0 Answers
How can i make a tiled/striped texture on a sphere ? (see example below) 0 Answers
How to partially change texture? 0 Answers
Not possible to cache assetbundles behind server authentication? 0 Answers