Model
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
| Type | Name | Description |
|---|---|---|
string | component | Path of the component containing the material |
string | material | Name of the material to toggle Supports * as a wildcard to match multiple materials by pattern |
bool | state | Determines the visibility state: • When true - restores the material to its original appearance• When false - replaces the material with a fully transparent override |
Returns
| Type | Name | Description |
|---|---|---|
bool | status | true on successful execution, or false on failure |
Examples
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)