How do I make an action occur with a delay, but after a timeout?
The setTimeout()
function doesn’t work in Decentraland scenes, so is there an alternative?
For example, I want an entity to wait 300
milliseconds after it’s clicked before I remove it from the engine.
A few years late, but the OP's selected answer is kind of deprecated because you can accomplish a delay doing:
import { Delay } from "node_modules/decentraland-ecs-utils/timer/component/delay"
const ent = new Entity
ent.addComponent(new Delay(3 * 1000, () => {
// this code will run when time is up
}))