dataarts / dat.gui

Lightweight controller library for JavaScript.
Apache License 2.0
7.46k stars 1.08k forks source link

gui.removeFolder gives a Uncaught TypeError: folder.domElement is undefined error #313

Open rushcodes opened 2 years ago

rushcodes commented 2 years ago

When I call:

gui.removeFolder(this.playerId);

or

folder.removeFolder('subfolder');

I get the error:

Uncaught TypeError: folder.domElement is undefined

I'm adding folders and subfolders like so:

this.playerFolder = this.scene.gui.addFolder(this.playerId);
this.targetPositionFolder = this.playerFolder.addFolder('TargetPosition');

this.scene is the scene object from the parent scene sent to a player object, playerId is a unique id per player. I'm calling it in the destroy() function above the super.destroy();

console.log'ing before calling either removeFolder() command shows the id exists. There is also a folder by that name.