pub struct ShaderVariantCollection {
pub m_Name: String,
pub m_Shaders: Vec<(PPtr, ShaderInfo)>,
}Expand description
ShaderVariantCollection is a class of the Unity engine since version 5.0.0f4. Exert from Unity’s scripting documentation: ShaderVariantCollection records which shader variants are actually used in each shader. This is used for shader preloading (“warmup”), so that a game can make sure “actually required” shader variants are loaded at startup (or level load time), to avoid shader compilation related hiccups later on in the game.In Unity, many shaders internally have multiple “variants”, to account for different light modes, lightmaps, shadows and so on. These variants are identified by a shader pass type, and a set of shader keywords. See ShaderVariant.Typical use of ShaderVariantCollection is to record the shader variants used during a play session from the editor (under Graphics Settings), save them out as an asset, and add to the list of preloaded shaders (again in Graphics Settings). Additionally, you could call WarmUp on a ShaderVariantCollection object manually.ShaderVariantCollection generally replaces the old Shader.WarmupAllShaders function.
Fields§
§m_Name: StringThe name of the object.
m_Shaders: Vec<(PPtr, ShaderInfo)>Vec<(PPtr<Shader>, ShaderInfo)>: (5.0.0f4 - 2022.3.2f1)