Skip to content
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

Uncaught TypeError: Cannot read property 'getIndex' of null at Text.getIndexList #5489

Closed
actionmoon opened this issue Jan 6, 2021 · 7 comments

Comments

@actionmoon
Copy link

actionmoon commented Jan 6, 2021

Version

Phaser Version:3.51.0
Operating system:Mac Pro
Browser:Version 87.0.4280.88 (Official Build) (x86_64)

Description

Phaser3

phaser.js:3680 Uncaught TypeError: Cannot read property 'getIndex' of null
    at Sprite.getIndexList (phaser.js:3680)
    at InputPlugin.sortHandlerGO (phaser.js:184065)
    at Array.sort (<anonymous>)
    at InputPlugin.sortGameObjects (phaser.js:184023)
    at InputPlugin.update (phaser.js:182073)
    at InputManager.updateInputPlugins (phaser.js:91398)
    at InputManager.onMouseMove (phaser.js:91606)
    at HTMLCanvasElement.onMouseMove (phaser.js:92768)

It only happens in my project when call text.setInteractive, but I can’t reproduce it in https://labs.phaser.io/edit.html

Example Test Code

var text = this.add.text(100, 100, 'Phaser');
text.setInteractive().on('pointerdown', () => {
console.log('hello world');
});

Additional Information

@photonstorm
Copy link
Collaborator

Does this example work for you? http://labs.phaser.io/view.html?src=src/animation/aseprite%20animation.js

As it uses Text objects down the left, all of which are interactive.

I've been looking at this for a while this morning, but I can't replicate it with something as simple as your example test code. So it has to be something else. Maybe Scene restart related? But if you try your test code in isolation, I'm confident it'll work fine. There's something outside of it triggering this.

@photonstorm
Copy link
Collaborator

Digging more into this today, created this test: http://labs.phaser.io/view.html?src=src/bugs/5489%20container%20input.js

Still can't trigger it. There must be something else being overlooked. A Scene restart maybe? Layer?

@Waclaw-I
Copy link
Contributor

Waclaw-I commented Jan 6, 2021

Hi! I've encountered the same problem. Still digging it, but I think this might have something to do with objects being interactive and overlapping.
I have a tab which retracts itself from the top menu. While hidden, buttons "above" it are throwing this error. I will try to reproduce it and give an example.

EDIT:
Working for Phaser. 3.50.0

@Waclaw-I
Copy link
Contributor

Waclaw-I commented Jan 6, 2021

https://jsfiddle.net/gkyor893/

Interactive object inside container which is below another object outside of this container is causing it.
Remove .setInteractive from square to make it work.

@photonstorm
Copy link
Collaborator

Yeah, I narrowed it down to objects inside Containers AND having another outside of it (not of the same type), because the internal one has a null displayList property. Looking at a way to fix it now, but will update this issue when it's closed.

@photonstorm
Copy link
Collaborator

Thank you for submitting this issue. We have fixed this and the fix has been pushed to the master branch. It will be part of the next release. If you get time to build and test it for yourself we would appreciate that.

@Sijak
Copy link

Sijak commented Jan 25, 2021

I happen to have this exact problem. I updated Phaser to 3.52.0. Problem went away right away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants