rememberMaterialInstance

fun rememberMaterialInstance(material: Material, engine: Engine = LocalFilamentEngine.current): MaterialInstance

Creates and manages a MaterialInstance from a Material. The instance is destroyed when this leaves the composition.

Parameters

material

The base material to instantiate.

engine

The Filament engine that owns the material. Defaults to the engine in the current composition scope; pass an explicit engine when calling outside rememberFilamentScene { }.