self:set_material_visible

Shared

Sets the visibility of one or more materials on a component


Syntax

local status = self:set_material_visible(
    component,
    material,
    state
)

Parameters

TypeNameDescription
stringcomponentPath of the component containing the material
stringmaterialName of the material to toggle
Supports * as a wildcard to match multiple materials by pattern
boolstateDetermines the visibility state:
• When true - restores the material to its original appearance
• When false - replaces the material with a fully transparent override

Returns

TypeNameDescription
boolstatustrue on successful execution, or false on failure

Examples

Toggle various material's visibility
local entity = model.create("character")

-- Hide a material
entity:set_material_visible("Skeleton3D/Head", "eyelash_style_1_material", false)

-- Show it again
entity:set_material_visible("Skeleton3D/Head", "eyelash_style_1_material", true)

-- Hide all eyelashes at once using a wildcard
entity:set_material_visible("Skeleton3D/Head", "eyelash_*", false)

-- Show only eyelash_style_1_material
entity:set_material_visible("Skeleton3D/Head", "eyelash_style_1_material", true)

On this page