Loading Shader at Runtime from Asset Bundle
I've been trying for the last few hours to load shaders from an asset bundle at runtime. An old project I have required shaders to be made from strings, finding that this was removed (for a reason I cannot discern) I'm having issues fixing it.
I cannot simply include the shader with a build of the game, and I can't seem to get it loading properly through a WWW.
Answer by phxvyper · Jun 16, 2016 at 08:58 PM
Unity cannot compile shaders at runtime as the shader pipeline hasn't been exposed by the API yet.
However, if the shader is an actual shader file with GLSL code that is in an assetbundle, you can use Shader.Find to return the Shader by name:
Material newMat = new Material(Shader.Find("Your/Shader"));
Your answer
Follow this Question
Related Questions
Importing particles at runtime with Asset Bundles 1 Answer
HDRP Transparency Shader with Runtime GLTF 0 Answers
Issues with video player coroutine 2 Answers
How to add modding/scripting support? 0 Answers
Toggle shader Pass at runtime 0 Answers