hi there,
i’m facing a problem with a layer in a scene.
i create a new layer for the scene and adding a rexUI table to it:
this.optionsLayer = this.scene.add.layer();
this.menu = new Table( this.scene,....);
this.menu.addToLayer( this.optionsLayer );
As soon as i start changing the scene, i get an error from the phaser.min.js (3.55.2) “destroy” method (codeline 13961):
TypeError: Cannot read properties of undefined
i see in debug, that phaser try to destroy my layer. Ok.
The layer itself has children (my table + the rexUI-elements automatically added for this table like sizer, slider, roundedRectangle, etc.)
the “table” element is destroyed first. And so: its children (on other table elements that are not added to a layer it works like it should).
So, in the next iteration of the “destroy” list for this layer, it tries to destroy another child. But this child is no more! And there it crashes…
How can i handle this behavior? Must i overwrite the “destroy” method for the layer object??
Screenshot of debugging:
Scene element gets destroyed. It calls child-list to destroy childs first. First iteration it has still 8 childs:
First child to be destroyed is my table:
And on the second iteration, no child is left on this layer and it crashes (child at t=6 is no more):
Thx you!