How to reset or changing the values of dat.gui in three js?

I am having two buttons in gui. One is “Total Number of cubes on the scene”. another one is “Add Cube”. The first one is initially set by me as “3”. so three boxes in the scene. Now I am creating another cube by pressing the another button “Add Cube”. So now I have 4 cubes on the scene. But still the “Total Number of Cubes on the scene” is showing as 3. How to update that value while I am adding new cubes.?

Any chance to provide an editable live code example? jsfiddle, codepen etc.

Thank you for your kind reply. I have fixed that. Just need to add .listen() function with that . Then update the value.

dat.gui isn’t part of THREE, only using it for the examples, since your question like the other one isn’t even involving THREE, please use their Github site for these questions/consult the api doc.


Oh. Okay @Fyrestar