Table of Contents

Class ShaderLookup

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Find(string) that also finds shaders loaded from Addressable bundles.

public static class ShaderLookup
Inheritance
ShaderLookup
Inherited Members

Remarks

In a player, Find(string) only knows the shaders built into the player (scenes in the build list, Resources, Always Included). The client's world content (terrain arrays, the weather profile, scenes) arrives in Addressable bundles, and its shaders were not found by name there even once loaded: on the web build (2026-11-08) the stored terrain index maps were not uploaded because a lookup by name returned null for the shader the loaded terrain set carried, and passing the set's reference fixed it. The editor and the benchmark players never showed it: there every shader is reachable by name.

A miss falls back to the loaded shaders themselves (UnityEngine.Resources.FindObjectsOfTypeAll<T>()), every name indexed at once, at most once per RescanSeconds so a caller asking each frame for a shader not loaded yet does not walk every object each frame. Found shaders are cached; a destroyed one is looked up again. Prefer a serialized reference where there is one; this is for the lookups by name.

Fields

RescanSeconds

Least time between two walks of the loaded shaders.

public const float RescanSeconds = 1

Field Value

float

Methods

Find(string)

The shader named name, built into the player or loaded from a bundle; null if neither.

public static Shader Find(string name)

Parameters

name string

Returns

Shader