[SOLVED] Block Input Events

How can I disable listening to input events till Play Button is clicked. In my case mouse down event causes the player ship to move so even if I am clicking on Play Button ship moves forward.
In Cocos creator there is something called blockInputEvents so is there any similar functionality in play canvas. How can I fix this issue.

Hi @gouthamamin!

You can use the example code below in the initialize function of your playButton script.

this.entity.element.on('mousedown', function(event) { event.stopPropagation(); }, this);
this.entity.element.on('touchstart', function(event) { event.stopPropagation(); }, this);

It’s using stopPropagation() to block input.

thank you. It is working now :+1: :+1:

1 Like