class in UnityEngine
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.Close
For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.Close
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 indentified 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.
|isWarmedUp||Is this ShaderVariantCollection already warmed up? (Read Only)|
|shaderCount||Number of shaders in this collection (Read Only).|
|variantCount||Number of total varians in this collection (Read Only).|
|ShaderVariantCollection||Create a new empty shader variant collection.|
|Add||Adds a new shader variant to the collection.|
|Clear||Remove all shader variants from the collection.|
|Contains||Checks if a shader variant is in the collection.|
|Remove||Adds shader variant from the collection.|
|WarmUp||Fully load shaders in ShaderVariantCollection.|
|hideFlags||Should the object be hidden, saved with the Scene or modifiable by the user?|
|name||The name of the object.|
|GetInstanceID||Returns the instance id of the object.|
|ToString||Returns the name of the object.|
|Destroy||Removes a GameObject, component or asset.|
|DestroyImmediate||Destroys the object obj immediately. You are strongly recommended to use Destroy instead.|
|DontDestroyOnLoad||Do not destroy the target Object when loading a new Scene.|
|FindObjectOfType||Returns the first active loaded object of Type type.|
|FindObjectsOfType||Returns a list of all active loaded objects of Type type.|
|Instantiate||Clones the object original and returns the clone.|
Did you find this page useful? Please give it a rating: