How to destroy input(drag) event?

Hello, all.

Is it possible to delete an this.input.on(‘drag’,pointer =>{}) event?

If it’s impossible to remove, is it possible to put a delay on the event?

Thank you in advance for your help!

Keep a reference to the callback function, then remove with off(), same arguments you used for on().

I use draggable container and i Needed at start of dragstart event - delete input drag event, but off didn’t help me

container.on("dragstart", (pointer) => {
  this.timerDrag = this.time.delayedCall(500, () => {
    this.input.on("drag", (pointer, gameObject, dragX, dragY) => {
      gameObject.x = dragX;
      gameObject.y = dragY;
    });
  });
});

I don’t think you need all that.

this.input.dragTimeThreshold = 500;
// …
container.on('drag', /*…*/);
// …
container.input.draggable = false;

My mechanic was that i need to hold gameobject (500 ms) to start drag this gameObject, that why i used drag in dragstart event. Can u have any ideas how can i make it by another way?

That’s the dragTimeThreshold value above.

How cain i Disable drag event while timer(dragTimeThreshold = 500) didn’t finished?