Unity Input System (NEW)
Last updated
Last updated
Added: OnMoveAxis Method from IInputSouce Interface.
Added: Ignore Horizontal, Vertical, UpDown Axis
Improved: Reading the axis from Move Context.
Added: OnInput Enabled and Disabled send the Player Index
Minor Editor fixes
These are the types of input values that the controller will recognize.
Use this Input type for Axis movement (Player Movement and Camera Movement)
If you are going to use Axis type in other logic besides Player Movement or Camera Locomotion
Use the Vector2 value on the interaction type:
Use this Input type for all button interactions (Jumps, Actions, Sprint, etc)
Triggers on your Gamepad need to be set as Value.
The Interaction type for Triggers needs to be set to Float
Go to Window -> Package Manager
Install the latest version of the Input System package.
Unity will ask you to restart the Editor to install correctly the Input System.
Download and Install the Integration package on your project.
Those Malbers Input/MInput Components, need to be replaced with the new MInput Link. But first, we need to check all the connections the old inputs can have.
The Animal Controller makes automatic connections with States and Modes using the Name of the Input.
For example for the State Jump the Input Name is "Jump"
Add the component to the same gameobject the Animal Controller is.
Add Unity Player Input Component and set it as reference for the Input Link
By default for Malbers Animals and creatures you can use the <Malbers Input> Action asset, but you can use your own Input Action Asset.
Add your Input Map to the Player Input Component
Add your Default Action Map so you can connect those inputs to the Animal Controller
After selecting the Active Action Map Click Find Buttons.
All the parameters will be filled automatically. with all the Inputs that are set as <Button> Type.
Move and UpDown Inputs will be set on their respective parameters.
You can add other inputs manually by simply creating a new element:
By default, all the Inputs with a Name that matches the States and Modes are connected automatically with the Animal Controller.
For example: the Jump State has an Input<string> value to find its Input so it will be connected automatically with the Jump Input:
Just like States, Modes has their Input<string> Value to connect automatically to the input source:
But other features like Sprint, Speed Up, Speed Down, they need to be connected manually.
As stated in Step 3. Do not remove yet just yet the MalbersInput/MInput component.
Check the connections all the Inputs have and do them on the New MInputLink component.
E.g. Sprint is connected on the Input Changed Event with Animal.Sprint
Interaction [Press]
E.g. SpeedUp is connected on the Input Down Event with Animal.SpeedUp
Interaction [Down]
E.g.: In case of the Rider in HAP the Default Action Map should be Gameplay:
E.g.: In case of the Horse in HAP the Default Action Map should be "Riding". So the horse will be only moving when that Action map is activated by the rider when he finish mounting
Instead of using the Default Virtual cameras
Use instead the new Prefab located here:
This prefab has already all the connections done for the new Input system. The MInput Look Component is using the correct Input Action References for moving the camera
This component will Invoke a String Event with the Display value of an Input Action, when the Control Scheme changes.
That Sprint Value can be connected to any UI Text to display the right UI Value for the Input.
Do that for all the UI Buttons.
For Horse Animset Pro the Rider and the Horse have Different Action maps
Use instead Malbers Input HAP. You can always modify it to your needs.
In the case of the Rider, you will need to change the Active Action Maps while Riding.
When the Rider Finish Mounting the Action Map is changed to "Riding" will be changed to Riding (Using the event MRider.OnMountEnd()
When the Rider Finish Dismounting the Action Map is changed back to "Gameplay" will be changed to Riding (Using the event MRider.OnDismountEnd()
Always check the old Malbers Input connections to apply it to the new MInput Link inputs
Here are the Malbers Input HAP "Gameplay" Input Action connections. Remember to check the Interaction on each Input Action.
Leave the Connection to Gameplay/Move Input Action
Jump
Is Connected automatically with the Animal Controller with the Jump State.
Here are the Malbers Input HAP, "Riding" Map, Input Action connections. Remember to check the Interaction on each Input Action. This will be the Inputs
Clear the Connections with Move and UpDown since they will be used on the Animal Mount Instead.
In case of the Horse instead of using the "Gameplay" Action Map as the Default and connection, will be using the "Riding" Action Map. That way all Horse Movement will be active only when the Rider finish mounting.
You can use all of the inputs or some of them. Is up to you. :)
Jump is connected Automatically with the Animal Controller
Attack1 is connected automatically with the Attack1 Mode. Is recommended to be disabled if the rider is using weapons
No connection here.. you can add the Action Mode Input name here if you like