rememberTexture
fun rememberTexture(engine: Engine = LocalFilamentEngine.current, type: TextureLoader.TextureType = TextureLoader.TextureType.COLOR, key: Any = Unit, onError: (Throwable) -> Unit? = null, load: suspend () -> ByteArray): Texture?
Asynchronously loads and manages a Filament Texture. Returns null while loading and on failure — it never throws inside composition. Pass onError to react when load throws (missing file, network error) or the bytes can't be decoded on this platform. See rememberMaterial for the engine-hoisting pattern when calling outside rememberFilamentScene { }.
Parameters
engine
The Filament engine to allocate the texture on. Defaults to the engine in the current composition scope.
type
Hints the loader about the texture's content (Color, Normal map, etc.).
key
Reloads the texture when this value changes. Defaults to Unit for static assets.
onError
Invoked once if load throws or the image can't be decoded. The texture stays null.
load
Suspend function that produces the raw image bytes.