Refreshing Parameter Sheet Visuals with Javascript Tool

Hello there,

I’ve been messing around with Javascript tools for Fmod, one of the tools I’m writing creates a labeled parameter sheet for an event.

When this parameter sheet is created, the parameter sheet only shows the first labeled value.


I need to open the edit parameter window and then just press ok to have it show all the labeled values like it should.
I’m guessing theres some kind of visual update function I’m not calling in my code and I was wondering what it was.

Here is the script I’m running:

studio.menu.addMenuItem({
    name: "Create Switch Sound",
    isEnabled: true,
    execute: createSwitchSound,
});

function createSwitchSound() {
    const eventSwitch = studio.project.create("Event");
    eventSwitch.name = "SwitchSound";

    const param = eventSwitch.addGameParameter({
        name: "ParameterTest",
        type: studio.project.parameterType.UserEnumeration,
    });
    
    param.preset.isGlobal = true;
    
    param.preset.enumerationLabels = ["label1", "label2","label3","label4","label5","label6"];

    const track = eventSwitch.masterTrack;

    const instrument = track.addSound(param, "EventSound", 1, 1);
        
    //param.properties.dump();
}

Thanks in advance.

Found the problem, it’s because the parameter’s maximum is set to a number lower than the amount of labels.

const paramArr = ["label1", "label2","label3","label4","label5","label6"];
    
    param.preset.enumerationLabels = paramArr;
    
    param.preset.maximum = paramArr.length;

This solved my issue.