So basically they’re a bit like the scripts, i.e. they must be in the main app. Although scripts are explicitly added to the project Assets. The shader in question is a Unity ‘built-in’ one, so I cannot explicitly add it anyway, so ‘forcing’ it in using a dummy object is the only way?
This leads me to another question:
When certain scripts are needed by a bundled asset only, do we have to ‘force’ them into the main app by having a dummy object with them attached? Just like I had to do with my shader? Or are all scripts in the project included, even if not used by the main app?
scripts are always present in code, they will not be removed.
For shaders you don’t need to add dummy either, just add them to Resources. Builtin shaders should theoretically always be present unless something strange happened. You can always for them in too by the way in case they really would be ‘opted out’, the builtin shaders bundle on the resources page above allows you to do that if you want to
This thread is a little old, but I’m posting information in related threads of our community, to clarify how Shaders and Asset Bundles work together, and how to avoid some conflicts. The shader’s code is included with the asset bundle, whenever shaders are directly referenced as parameters in BuildPipeline.BuildAssetBundle(), or indirectly with option BuildAssetBundleOptions.CollectDependencies. This could cause a problem if you use BuildAssetBundle alone to create several asset bundles, since referenced shaders will be included in every generated bundle. There could be conflicts, i.e. when you mix different versions of a shader, so you will have to rebuild all your bundles for any modification. This also increases the size of bundles. To avoid these problems you can use BuildPipeline.PushAssetDependencies() to separate shaders in a single bundle, and that will allow you to update the shader bundle only. We are adding a page to the manual with more information on this topic and examples of the workflow to build a shader bundle.
This is also very old, but scripts don’t necessarily have to be included in the main app. You can include them as a a text asset and then compile them on the fly when loading. We actually do that using dll’s which contain these forms of scripts inside asset bundles.