I'm dynamically adding controls to a dat.gui interface, but the "save settings" functionality doesn't recognize them.
var mygui = new dat.GUI();
mygui.remember(mygui);
// standard way of adding a control
mygui.control1 = 0.0;
var control = mygui.add(mygui, 'control1', -1, 1);
// adding controls dynamically
var myArray = ['control2', 'control3'];
var controls = [];
for (x in myArray) {
controls[myArray[x]] = 0.0;
var newControl = mygui.add(controls, myArray[x], -1, 1);
}
The controls all work as expected, but when I click the gear icon, the settings JSON only contains the first control, or any other controls I add in the normal way:
{
"preset": "Default",
"closed": false,
"remembered": {
"Default": {
"0": {
"control1": 0.5,
}
}
},
"folders": {}
}
I assume I'm confusing the remember() functionality somehow, any ideas?