Container methods not working?

Hello there,
I’m using Phaser, and have a Container of Sprite’s; I’m attempting to call the helper methods that are provided such as moveTo, moveUp, etc… but they don’t work. If I log them I can see the changes, but not in the actual sprites being rendered.

Do I need to trigger a re-render somehow or something?

Thanks.

:wave:

Is there one container? You’re sure the sprites are in it? What do you see logged?

My Container

export default class BaseContainer extends Phaser.GameObjects.Container
{
    constructor(scene:Phaser.Scene, x:number, y:number, children?:Phaser.GameObjects.GameObject[]) {
        super(scene, x, y, children);
        scene.add.existing(this);
    }
}

I add my sprites and can see them in the container here;

If I call this.shuffle(); on my Container, I can log the list object above before/after and see it has shuffled them successfully. However, the actual rendering of these sprites does not reflect that, it just stays static as the initial order before calling shuffle. I assume this is because it is not re-rendering after the shuffle change has been made, but I’m not entirely sure how to get it to re-render.

Hopefully this is helpful! Thanks.

And what do you see rendered?

The render lines up with my before shuffle output, and not after shuffle.

The red box is just a temporary button that when clicked does container.shuffle().

It will only change the render depths, so if the sprites don’t overlap you won’t see anything different.

This applies to even shuffle? That seems a bit odd. I’ve looked at some of the methods in the docs and their descriptions make it sound like exactly what I want. E.g moveTo(child, index).
Even this function doesn’t work, yet when I read the docs for it, it states that it will move the child to the specified index, and it does, but it just doesn’t re-render?

What result do you want to produce visually?