class in UnityEngine
/
Inherits from:Object
/
Implemented in:UnityEngine.CoreModule
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.
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 | Removes shader variant from the collection. |
WarmUp | Prewarms all shader variants in this shader variant collection. |
hideFlags | Should the object be hidden, saved with the Scene or modifiable by the user? |
name | The name of the object. |
GetInstanceID | Gets 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 | Gets a list of all loaded objects of Type type. |
Instantiate | Clones the object original and returns the clone. |
bool | Does the object exist? |
operator != | Compares if two objects refer to a different object. |
operator == | Compares two object references to see if they refer to the same object. |