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 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 GameObject. |
Destroy | Removes a gameobject, component or asset. |
DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
DontDestroyOnLoad | Makes the object target not be destroyed automatically 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. |
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. |
Did you find this page useful? Please give it a rating: