'Change Unity XRController InputActions with InputActions from another script

I am having problems accessing and changing the Unity XRController input actions from another script. I have setup my XR Origin and underneath it in the hierarchy there is the Camera Offset node with the camera and both controllers. Is it possible to change/overwrite the InputActions of the XRController (for example the UI Press Action) from another script e.g. one that is attached to the XR Origin?

I would like to call something like the following:

public InputActionProperty myAction;

...

xrController = rightControllerGO.GetComponent<XRController>();
// change uiPress ()
xrController.uiPressAction = myAction;   // this line will cause an error

I have seen that uiPressUsage is available but it requires InputHelpers.Button and I am not sure how to set new InputActionProperty. Any hint or help is appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source