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

GraphicsStateCollection.Append

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

Declaration

public Boolean Append(UnityEngine.Experimental.Rendering.GraphicsStateCollection collection);

Parameters

Parameter Description
collection GraphicsStateCollection to append to this collection.

Returns

Boolean Returns true if the collection was successfully appended, false otherwise.

Description

Adds all new graphics states and shader variants from the given collection to this collection.

Append can be commonly used to add states and variants from the cacheMissCollection into this collection after tracing cache misses via WarmUp. collection must not be currently tracing.

using UnityEngine;
using UnityEngine.Experimental.Rendering;
using Unity.Jobs;

public class AppendExample : MonoBehaviour { public GraphicsStateCollection graphicsStateCollection; public string filePath;

void Start() { // Start prewarming without any job dependencies and trace any missing graphics states that get created after warmup JobHandle handle = graphicsStateCollection.WarmUp(new JobHandle(), true); }

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

// Update the current collection to include any new graphics states and then save to file if (graphicsStateCollection.cacheMissCollection.totalGraphicsStateCount > 0) { graphicsStateCollection.Append(graphicsStateCollection.cacheMissCollection); graphicsStateCollection.SaveToFile(filePath); } } }

Additional resources: cacheMissCollection, isTracing.