-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input.alwaysEnabled does not work when a interactive game object is below it #5507
Comments
Thank you for submitting this issue. We have fixed this and the fix has been pushed to the |
I test it in my project it did not fix the issue. The problem is that invisible game objects with "input.alwaysEnabled = true" it is always put behind visible game object when it come to input even when the depth of the invisible game object is higher. for the project i am working on we did fixed it by using a sort function like this in inputPlugin:
But i am not confident that it is good fix for the problem but it works in our case |
Using your test passes with a fresh build of Beta 4: http://labs.phaser.io/view.html?src=src%5Cbugs%5C5507%20always%20enabled.js&v=dev |
My test is not great it only has one object that is below the invisible one and because both the visible and invisible is at sorted as if they have a index of 0 in the renderList. It appears that work, but if you add one more object it fails. var config = {
type: Phaser.AUTO,
parent: 'phaser-example',
width: 800,
height: 600,
scene: {
create: create
}
};
var game = new Phaser.Game(config);
function create()
{
var invisibleRect = this.add.rectangle(400, 300, 300, 300, 0x00ff00);
var rect = this.add.rectangle(400, 300, 256, 256, 0x0000ff).setAlpha(0.5);
var rect2 = this.add.rectangle(350, 300, 256, 256, 0xff0000).setAlpha(0.5);
var text = this.add.text(128, 128, "0").setFontSize(28);
var count = 0;
invisibleRect.name = 'invis';
invisibleRect.setInteractive();
invisibleRect.input.alwaysEnabled = true;
invisibleRect.on('pointerdown', function () {
count++;
text.text = count.toString();
});
rect.name = 'rect';
rect.setInteractive();
rect2.name = "rect2"
rect2.setInteractive();
invisibleRect.alpha = 0;
//invisibleRect.alpha = 0.3;
invisibleRect.setDepth(1);
rect.setDepth(-2);
rect2.setDepth(-1);
} Video.mp4 |
Looking at this further, the issue is this line of code within |
Version
Description
interactive object that are invisible and has a interactive object behind it, do not receive input events even if it has "input.alwaysEnabled = true"
Example Test Code
Additional Information
Did some testing a i begin to get the bug after the commit "616566c - Renamed
sortGameObjects
tosortDropZones
and then repurposed the old method for the new render list sorting technique."The text was updated successfully, but these errors were encountered: