Version: 2021.2
언어: 한국어

ShaderVariantCollection

class in UnityEngine

/

다음으로부터 상속:Object

매뉴얼로 전환

설명

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.

변수

isWarmedUpIs this ShaderVariantCollection already warmed up? (Read Only)
shaderCountNumber of shaders in this collection (Read Only).
variantCountNumber of total varians in this collection (Read Only).

생성자

ShaderVariantCollectionCreate a new empty shader variant collection.

Public 함수

AddAdds a new shader variant to the collection.
ClearRemove all shader variants from the collection.
ContainsChecks if a shader variant is in the collection.
RemoveAdds shader variant from the collection.
WarmUpPrewarms all shader variants in this shader variant collection.

상속된 멤버

변수

hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameThe name of the object.

Public 함수

GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

정적 함수

DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindObjectOfTypeReturns the first active loaded object of Type type.
FindObjectsOfTypeGets a list of all loaded objects of Type type.
InstantiateClones the object original and returns the clone.

연산자

boolDoes 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.