Hi! My game uses a custom-built framework that doesn’t use the asset system whatsoever except for scripts. Now that I have stated this the next thing is obvious:
It loads models at runtime.
When it loads models at runtime it also parses a. shaders file. A fully-customizable file that allows the materials within a model to use any shader with any customization parameters needed. Bumpmaps, cubemaps, specular, even animation (by setting tiling parameters).
Now here’s the question : The current way to add shaders to the build is creating a quad in the menu with a material that has the shader I need, which gets annoying to do and limits the shaders file capability to only a few shaders. So is there anyway to specify what shaders to include in the build ? I’ve tried putting the shaders into the resources folder from the builtin shaders but that resulted in very weird shadows and I did not like that method at all anyways.
Its not intended to have the standard shader linked there.
Unity does include all variants of the shaders linked there and that is way to much for the standard shader.
You should use a or multiple ShaderVariantCollection to make sure that all shader variants you whant to use are included. https://docs.unity3d.com/ScriptReference/ShaderVariantCollection.html
Can someone explain step-by-step how to include some of the standard Unity shaders into Assets so that they appear in the build? I use Shader.Find() and it works perfecty in Editor, but in the build all the shaders set this way are gone. I need to download sources of older versions of Unity and take shaders from there?
You can probably put all the shaders you want in a folder named exactly “Resources” anywhere in your project and they will be included in the build and Shader.Find() should work.
… but you can download the shaders here (click on the “Downloads” dropdown of the version you want and pick “built in shaders”) and copy the “.shader” file from the arch into the “Resources” folder, then they can indeed be accessed with “Shader.Find()”.
This is still happening in 2017.3.1f1 but fortunately you don’t have to add the “Standard” shader, at least in my app it’s accessible without actually assigning a material with the shader to an invisible GameObject (to make Unity export it in a build).