Skip to main content

ShaderVariantWarmer

A class in Root.Township, the global namespace.

Scene root component that warms up shader variant collections for the active platform so shaders don't compile mid-game. AltaSceneManager calls Warm on it when a scene loads.

Constructors​

MemberWhat it is
ShaderVariantWarmer()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

3 private and internal fields
MemberWhat it is
private ShaderVariantWarmer.PlatformCollection[] collectionsToWarmPer-platform sets of shader variant collections to warm.
private bool isWarmSet on the first Warm call so warming only runs once.
private static Logger loggerNLog logger used to log how long each collection took to warm.

Properties​

MemberWhat it is
int SortingOrder { get; }Bake order for the build pipeline. Always 0.

Methods​

MemberWhat it is
void Bake(bool isSaving)Build step: on Linux (the server build) drops all collections; otherwise prepares each platform's runtime collection list.
void Clean()Empty bake clean-up step.
async Task Warm()Warms each platform collection once, yielding between them. Later calls do nothing.
1 private and internal method
MemberWhat it is
private void Start()Calls Warm when the object starts.