Skip to content

Destroyable Objects

Swifter edited this page Feb 7, 2025 · 3 revisions

Prerequisites

How Destroyable Objects Work

Certain events (such as InstantiatePrefab, CreateCamera, and CreateScreenTexture) represent an object that is created with an id and then can later be destroyed.

ReMapper's implementation of these events recognize this, and provide a destroyObject function to do so automatically.

const prefab = rm.instantiatePrefab(map, {
    beat: 3,
    asset: 'assets/myprefab.prefab',
    id: 'myPrefab1'
})

prefab.destroyObject({
    beat: 6
})

It creates a DestroyObject event that uses the same id as the event it was created from.


You can also call the function with just a beat to destroy the object at.

prefab.destroyObject(6)

Clone this wiki locally