Skip to main content

decode_material

Function decode_material 

Source
pub fn decode_material(bytes: &[u8]) -> Option<Box<dyn Material>>
Expand description

Decodes .kmat RON bytes into a [Material] without the runtime AssetService, returning None on any failure.

The index builder calls this to read a material’s texture references while scanning a project, where spinning up the asset service would be both heavyweight and circular. Because MaterialDecoder is stateless and dispatches purely through the inventory type-tag registry, decoding needs nothing but the bytes. A decode failure is intentionally swallowed (the caller logs and continues); use MaterialDecoder::load when the error detail matters.