Jump to content

Phaser hangs unexpectedly, "Cannot set property '__next' of null"

Recommended Posts



We have a 3/4 perspective game running at 800x800 with about 50 32x32 sprites on the screen at one time.


After loading our game, within about 30 seconds with movement of our character, the game starts to bog down, shortly hangs, and we receive the error in the Javascript Console:


Cannot set property '__next' of null (line 4197 of phaser.js)


We are running the dev version of phaser, but have tried with the stable version with no success either.

I suspect we just need to optimise our game, but it doesn't seem to be overly complicated - we are surprised that it starts to bog down with only 80 or so sprites on the screen.


Any help would be greatly appreciated


Link to post
Share on other sites

That line of code is part of the Pixi library rather than Phaser itself. Something to do with WebGL batching. Might be worth asking over in the Pixi forum or on github.


Not sure what the problem is, but it seems that part of the code is traversing sprites with their internal linked lists - is it possible that you're setting a sprite to null before this function gets called? 

Link to post
Share on other sites

Lewis, we looked at the code too. All we are doing is looping through our local array of sprites, and setting their velocities in the update() function.


On further inspection, it seems to be the depth sorting we are doing that breaks it. We can add 500+ sprites with no issues, but if we have 100 sprites with depth sorting, it starts to bog down and eventually hangs.


We are thinking of implementing a chunking system with groups, and then only depth sorting groups against each other. This is great and all, but what happens with the sprites? How do we depth sort them against the groups if they can move between different groups? Ideas? 


Thanks for your help

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...