Is there a way to hotswitch a key in the existing ExecuteCodeAction?

Hi everyone!
For example I have an action when ‘E’ button is pressed:

scene.actionManager = new BABYLON.ActionManager(scene);
scene.actionManager.registerAction(new BABYLON.ExecuteCodeAction({ trigger: BABYLON.ActionManager.OnKeyDownTrigger, parameter: 69 },
            function () {
               //do something.
            })
        );

For example user has changed his controls settings, and now it’s ‘F’ button (keyCode 70).
Can we update a key in the existing ExecuteCodeAction, without unregistering this one and registering the new one (with a new key)?

Direct approach like this doesn’t work:

scene.actionManager.actions[0].triggerOptions.parameter = 70;

Hey!
this should work! can you repro on the PG so I can find a fix for you!

Hi!

Here it is: Babylon.js Playground

Here is an hack

https://playground.babylonjs.com/#X201Y8#1

I will expose the _triggerParameter with a setTriggerParameter(value) function :slight_smile:

Thanks!