2D Vector Composite w/ New Unity Input System
This article is going to explain what a 2D Vector Composite is within the New Unity Input System.
→ Add an action to your action map and on the right-hand side set the action type to value.
→ Under the control type set it to Vector 2.
→ Click on the Plus symbol next to the Action you have created and select the Up\Down\Left\Right Composite.
→ Set the 2D Vectors composite type to 2D Vector.
→ Set the Mode to Digital Normalized.
→ On each Up, Down, Left, Right binding → Select the Path and bind it to a key.
(Most people use the traditional keys for movement, but you can use any keys you want.)
What this is going to do now is replace the Input.GetAxis(“Horizontal”);
and the Input.GetAxis(“Vertical”);
You have essentially created your own custom axis that you will read its value to create movement.
In my example A,D will read a -1,1 value on the horizontal axis and W,S will read a -1,1 on the Vertical axis. You will get the same values for the keys you assign.
var move = _input.Player.Walk.ReadValue<Vector2>();
Above is an example of how you can store the value of your Input map into a variable to then later use to manipulate other Vectors.