I am a little stuck at the moment, spent quite a bit of time debugging into Phaser to see what is going on, and could really use a little advice.
I currently have a main scene that then creates 4 sub-scenes dynamically at run time. In those dynamically created scenes I utilize numerous groups as pools.
Everything works correctly. I now navigate to another screen, but before I do I manually remove the dynamically created scenes and then issue the scene.start to move to another scene.
This also works correctly.
However, when I navigate back to the first screen, it successfully creates the 4 dynamically created sub-scenes and all of the groups appear to be created correctly with their children initially set to an empty array.
But when a timer event is called some of the groups have their children now undefined, which causes an error on getting an item from the pool.
Uncaught TypeError: Cannot read property ‘entries’ of undefined
The only place I can find in the Phaser 3 code that sets the children is the destroy method, but it doesn’t appear to be called after I navigate back to the first scene. My first though was that there might be some events being triggered after the scene is up and running, but that doesn’t appear to be the case.
I could try to move away from dynamically creating and destroying sub-scenes, but wasn’t sure why the groups were getting set up correctly, but then changing.
Sorry for the long post, but just wondering if anyone has run into something like this before.
Thank you.