Hello!
I’ve recently been working on a game that has a reset button. In my use case, the reset button fires a bunch of events and then is tweened off screen rather than just disappearing. The only issue with this is that the button remains active as its being moved off screen allowing the user to press it multiple times. In order to fix this I was hoping to do something like this (this is from a test project I made) :
var StartButton = pc.createScript('startButton');
// initialize code called once per entity
StartButton.prototype.initialize = function() {
this.entity.element.on('touchend', function(){
console.log("button press");
this.entity.button.active = false;
}, this);
this.entity.element.on('mousedown', function(){
console.log("button press");
this.entity.button.active = false;
}, this);
};
After this script is fired, the button does not become inactive and still responds to being clicked on by outputting the console log message. Why is this? Is anyone able to tell me why its not disabled? Here is a test project as well: https://playcanvas.com/project/799870/overview/button-test