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 | ¿Debería el objeto estar oculto, guardado con la escena o modificable por el usuario? |
name | El nombre del objeto. |
GetInstanceID | Devuelve el id de la instancia del objeto. |
ToString | Returns the name of the GameObject. |
Destroy | Elimina un gameobject, componente o asset. |
DestroyImmediate | Destroys the object obj immediately. You are strongly recommended to use Destroy instead. |
DontDestroyOnLoad | Hace que el objeto target no sea destruido automáticamente cuando se cargue una nueva escena. |
FindObjectOfType | Devuelve el primer objeto activo cargado de tipo type. |
FindObjectsOfType | Devuelve una lista de todos los objetos activos cargados de tipo type. |
Instantiate | Clona el objeto original y devuelve el clon. |
bool | ¿Existe el objeto? |
operator != | Compare si dos objetos se refieren a un objeto diferente. |
operator == | Compara dos referencias de objeto para ver si se refieren al mismo objeto. |