Skip to main content

LayerSet

APJS Script API reference for the LayerSet class.

TypeNameInterface Description
Functionsconstructor(bitset?: number, mask?: number)

Function: Constructs a LayerSet instance.

Parameters

bitset: - Optional parameter that can be: - A number representing the count of bits for a new DynamicBitset - Undefined/null, in which case a new DynamicBitset with 64 bits is created

mask: - Optional parameter representing the mask value for the DynamicBitset. Defaults to 0 if not provided.

Functionsclear(bitsNum?: number): this

Function: Clears the layer set by setting all bits to false.

Parameters

bitsNum: - Optional parameter specifying the number of bits to clear. If not provided or 0, defaults to 64 bits.

Returns This LayerSet instance for chaining.

Functionsequals(v: LayerSet): boolean

Function: Compares the current LayerSet with another LayerSet for equality.

Parameters

v: - The LayerSet to compare against.

Returns A boolean indicating whether the two LayerSets have identical bit patterns.

Functionsget(layerIndex: number): boolean

Function: Retrieves the value of a specific layer.

Parameters

layerIndex: - The index of the layer to retrieve.

Returns A boolean indicating whether the specified layer is active or not.

FunctionsisEmpty(): boolean

Function: Checks if the layer set is empty (all bits are false).

Returns A boolean indicating whether all layers are inactive.

Functionsset(layer: number, value: boolean): this

Function: Sets the value of a specific layer.

Parameters

layer: - The index of the layer to set.

value: - The boolean value to assign to the layer.

Returns This LayerSet instance for chaining.

FunctionstoString(): string

Function: Returns a string representation of the LayerSet object.

Returns A string representing the LayerSet object.

Examples

constructor(bitset?: number, mask?: number)

let obj = new APJS.LayerSet();

get(layerIndex: number): boolean

if (camera.renderLayer.get(sceneObject.layer)) {
// Do something.
}

set(layer: number, value: boolean): this

const LAYER_DEFAULT = 0;
const LAYER_1 = 1;
camera.renderLayer = camera.renderLayer.set(LAYER_DEFAULT, true);
camera.renderLayer = camera.renderLayer.set(LAYER_1, true);

Use Case

@component()
export class NewBehaviourScript extends APJS.BasicScriptComponent {
onStart() {
// TODO: instantiate / use LayerSet here
}
onUpdate(deltaTime: number) {
}
}
Copyright © 2026 TikTok. All rights reserved.
About TikTokHelp CenterCareersContactLegalTerms of ServicePrivacy PolicyCookies