I’m trying to figure out how to implement a setting that allows the player to control whether the Y-axis input is inverted for a Vector2 action.
It’s easy enough to do this at configuration time, as you can simply add an InvertVector2 processor to the InputAction, and you’re all set. However, I don’t want to permanently set the Y-axis to inverted, instead I want the player to be able to toggle whether the Y-axis is inverted while playing. The problem is that this requires modifying the InputAction at runtime rather than edit time, and after reading through the documentation I can’t see how to modify the processors on an InputAction at runtime. Is this possible? Or do I need to remove the existing action and create a new one?
This isn’t great ATM. An API to set parameters on actions dynamically is coming.
ATM it generally requires writing processors that read out their configuration from global state. E.g. having a SensitivityProcessor that reads a “sensitivity” configuration setting.
The only alternative with the current API is to set binding overrides using InputBinding.overrideProcessors.
Thanks for the response. I ended up going down the binding overrides route in the end. That works fine-ish for now, but I look forward to better support down the road.
Still it’s not clear how to use the InputBinding.overrideProcessors
I’ve tried smth like this to add an invert X configuration:
for (var i = 0; i < gameControls.PalyerGeneral.Camera.bindings.Count; i++)
{
var cameraBinding = gameControls.PalyerGeneral.Camera.bindings[i];
if (invertX)
cameraBinding.overrideProcessors = "InvertVector2(invertY=false)";
gameControls.PalyerGeneral.Camera.ApplyBindingOverride(i, cameraBinding);
}