Componentmanager

ComponentManager class

A ComponentManager is a container for all the components of a space. It is responsible for creating, destroying and duplicating components.

Signature:

export declare class ComponentManager extends AugmentedGroup 

Extends: AugmentedGroup

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the ComponentManager class.

Properties

Property

Modifiers

Type

Description

components

readonly

Component3D<import("../../scripting").Component3DData>[]

loaded

readonly

Promise<void>

Methods

Method

Modifiers

Description

_updateComponentTag(component, tag, prevTag)

addLoadTask(promise)

byId(id)

Returns a component by its id.

byInternalId(id)

byName(name)

Returns all components with matching name.

byTag(tag)

Returns all component with matching tag. A tag is a string identifier that can be used to group components.

byType(type)

Returns all components with matching type.

create(data, opts)

create a new component of the given type. You can pass additional data that will be used to initialize the component.

destroy(component)

Removes the given component from the space.

duplicate(component, opts)

Duplicates the given component.

filter(f)

Returns all components satisfying the given filter function.

find(f)

Returns the first component satisfying the given filter function.

forEach(f)

Iterates over all components and calls the given function for each one.

onSpaceLoaded(cb)