Inheriting container doesnt work

I’m trying to create separate classes while inheriting containers. Containers work just fine on its own, but when I try to create something that inherits containers, nothing shows up. Is there something wrong with how i’m creating this container? (these are all separate files btw)

export default class SomeThing extends Phaser.GameObjects.Container {
	constructor(scene, x, y) {
		super(scene, x, y);
		scene.add.existing(this);
		console.log("SomeThing Created");
	}
}

export class Game extends Scene {
    constructor () {
        super('Game');
    }

    create () {
        var test = new SomeThing(0, this, 20, 20); // The console message shows up here just fine

        var b = this.add.sprite(0, 0, 'items', 'items0001.png');
        test.add(b); //If i dont add it to the container its fine. If i do, it disappears.
    }
}

You should see an error like

TypeError: undefined is not an object (evaluating ‘scene.sys.queueDepthSort’)

Change to

var test = new SomeThing(this, 20, 20);

Ooops sorry. I modified my code slightly to show bare bones stuff.

My constructor actually has an ID as a number: constructor(id, scene, x, y).

Regardless, this still doesnt show up anything when i omit the ID.

This worked for me.

I couldnt understand why yours was working, but didnt try building what i wrote here on its own, instead vying for my own code.

The issue was that I was declaring variables that conflicted with things contained within the container object. :man_facepalming:

Thank you for the help. The solution was my own stupidity