This class shows an example of using BindingAPI to create a PlayerAction and OneAxisInputControl. What it does is it attaches a MonoBehaviour to the ETGModMainBehaviour GameObject. Our MonoBehaviour will create our bindings and also contain all the logic for our bindings.

For my PlayerAction it was set to kill the player on it being pressed, to do this we use an if-statement with PlayerAction.wasPressed within it, then anything we want to do is inside our if-statement.

With our OneAxisInputControl we don't do anything on it being pressed or anything, we rather continuously take its value, because remember, its constantly has a value based on the PlayerActions you passed as arguments, so we could use its value as a speed increase/decrease.

Last updated