Documentation

Unity Engine

Download Unity

Unity Engine

ChunkEvictionStrategy

Specifies the strategy Unity uses to evict shader variant chunks from memory.
Read time 2 minutesLast updated 4 days ago

Definition

public enum ChunkEvictionStrategy

Remarks

Shaders store their variant data in chunks to reduce memory usage when Unity loads shaders that have a large number of variants. Use this enum to control how quickly Unity evicts chunks from memory after it stops using them. This setting works with the Shader.maximumChunksOverride setting as follows:
This setting affects only the Unity Player.
Additional Resources: Shader.chunkEvictionStrategy.

Examples

using UnityEngine;using UnityEngine.Shaders;// Attach this script to a GameObject and enter Play mode. Unity prints "Default chunk eviction strategy: Aggressive" in the Console window.public class ShaderChunkEvictionStrategy : MonoBehaviour{ void Start() { ChunkEvictionStrategy strategy = Shader.chunkEvictionStrategy; Debug.Log("Default chunk eviction strategy: " + strategy); }}

Fields

Value

Description

AggressiveEvicts a chunk from memory after Unity doesn't use it for a small number of rendered frames.
MediumEvicts a chunk from memory after Unity doesn't use it for a moderate number of rendered frames.
NeverDoesn't evict chunks based on how many frames have passed since Unity last used them.
SlowEvicts a chunk from memory after Unity doesn't use it for a large number of rendered frames.