Version: Unity 6 (6000.0)
LanguageEnglish
  • C#
Experimental: this API is experimental and might be changed or removed in the future.

GraphicsStateCollection

class in UnityEngine.Experimental.Rendering

/

Inherits from:Object

/

Implemented in:UnityEngine.CoreModule

Suggest a change

Success!

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

Submission failed

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

Cancel

Description

Collection of shader variants and associated graphics states.

Use graphics state collections to record shader variants and graphics states encountered at runtime and prewarm shader variants.

Each shader variant in the collection may have one or more associated graphics states. Each permutation of a shader variant and a graphics state will result in a single GPU representation of the shader being created by Unity.

using UnityEngine;
using UnityEngine.Experimental.Rendering;

public class GraphicsStateCollectionTracing : MonoBehaviour { public GraphicsStateCollection graphicsStateCollection;

void Start() { graphicsStateCollection = new GraphicsStateCollection(); graphicsStateCollection.BeginTrace(); }

void OnDestroy() { graphicsStateCollection.EndTrace(); } }

Properties

completedWarmupCountThe number of shader variant permutations that have been warmed up.
graphicsDeviceTypeThe graphics device API type the collection is intended to be used with.
isTracingFlag indicating if the collection is actively tracing shader variants and graphics states.
isWarmedUpFlag indicating if the collection is warmed up.
qualityLevelNameThe quality level the collection is intended to be used with.
runtimePlatformThe platform that the collection is intended to be used with.
totalGraphicsStateCountThe total number of graphics states across all shader variants in the collection.
variantCountThe number of shader variants contained in this collection.
versionThe current version of the collection.

Constructors

GraphicsStateCollectionCreate a GraphicsTextureCollection populated with contents of a file, or empty.

Public Methods

AddGraphicsStateForVariantAdds a new graphics state associated with a shader variant.
AddVariantAdds a new shader variant to the collection.
BeginTraceStart tracing shader variants and graphics states encountered at runtime.
ClearVariantsClears all shader variants and associated graphics states from collection.
ContainsVariantCheck if variant exists in collection.
EndTraceStop tracing shader variants and graphics states encountered at runtime.
GetGraphicsStateCountForVariantGet the number of graphics states associated to a shader variant.
GetGraphicsStatesForVariantPopulate given list with graphics states associated with input shader variant.
GetVariantsPopulate given list with shader variants contained in collection.
LoadFromFileLoad the GraphicsStateCollection at the given path.
RemoveGraphicsStatesForVariantRemove all associated graphics states from a shader variant.
RemoveVariantRemove shader variant and associated graphics states from collection.
SaveToFileSave GraphicsStateCollection to disk.
SendToEditorSend GraphicsStateCollection to the Editor using PlayerConnection.
WarmUpPrewarms all shader variants in this collection using associated graphics states.
WarmUpProgressivelyPrewarms the given number of shader variant permutations using associated graphics states.

Inherited Members

Properties

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

Public Methods

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

Static Methods

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.
FindAnyObjectByTypeRetrieves any active loaded object of Type type.
FindFirstObjectByTypeRetrieves the first active loaded object of Type type.
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
InstantiateClones the object original and returns the clone.
InstantiateAsyncCaptures a snapshot of the original object (that must be related to some GameObject) and returns the AsyncInstantiateOperation.

Operators

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.