Mouse events triggered twice


I am using Defold on a Mac.

I have one key bindinng - Button 1 > mouse_button_left

Every time I click the left button, I get two pressed everns and then two released events.

To try and work out why this is happening, I have inserted the following code in the on_input function:

if action_id == hash("mouse_button_left") then
	if action.pressed then
		print "pressed"
	elseif action.released then
		print "released"

I get two “pressed” messages and (then when I released the mouse) two “released” messages.

Any idea why this is happening? It’s messing up my code as I have a button that can only be pressed once yet it is receiveing two pressed triggers.

Is there a solution or anything that I am missing something?

Do you have two script instances listening on the same events?

No. The whole application only has one on_input function, which is in the gui script.

1 Like

Could you make a tiny example project where it reproduces?

1 Like

Good idea.