Script Input adjusted dynamically

Options
100%spam
100%spam Posts: 8
edited October 2022 in Feature Request #1

Hi Snap Forum!
I am looking to create a Dynamic Dropdown Menu System. I would like to read out how many inputs are in an array and then generate an array for each of these. This way the User can add or remove buttons and sub buttons as they want.

Example: A User defines 2 Buttons. The script recognizes that there are 2 buttons and generates input fields in the script inspector for 2 arrays that I have named "childButtons" below. These can either be assigned with UI Buttons or simply left blank.

//@ui {"widget":"group_start", "label":"Parent_Buttons_Array"}
//@input Component.ScreenTransform[] parentButtons;
//@ui {"widget":"group_end"}
//@ui {"widget":"label"}

var parentLength = script.parentButtons.length;
//EACH Parent has its own array of buttons : for every parent create an  array of children buttons
for (i = 0; i < parentLength; i++) {
//@ui {"widget":"group_start", "label":"Child_Buttons_Array"}
//@input Component.ScreenTransform[] childButtons;
//@ui {"widget":"group_end"}
//@ui {"widget":"label"}
    };
2
2 votes

Active · Last Updated