Model
self:set_component_visible
Shared
Toggles the visibility of one or more components on the model
Syntax
local status = self:set_component_visible(component, state)Parameters
| Type | Name | Description |
|---|---|---|
string | component | Path of the component to update Supports * as a wildcard to match multiple components by pattern |
bool | state | Determines the component's visibility: • When true - the component is shown• When false - the component is hidden |
Returns
| Type | Name | Description |
|---|---|---|
bool | status | true on successful execution, or false on failure |
Examples
local entity = model.create("character")
--Show the hat
entity:set_component_visible("Skeleton3D/Hat", true)
--Hide the hat
entity:set_component_visible("Skeleton3D/Hat", false)
--Hide all hats at once using a wildcard
entity:set_component_visible("Skeleton3D/Hat_*", false)
--Show only Hat_1
entity:set_component_visible("Skeleton3D/Hat_1", true)