Unity new Input System : Player Input Component (Part XIII)
We back to Unity, and attach the script to Player
Now, if we click on Events, it opens a menu for us with already the events implemented with UnityEvents system
And these are the same that we have here
Move, Look and Fire.
As I said before, I focus only to the movement, but the logic is absolutely the same for the other implementations
What we have to do now?
Well, we use this system exactly as the Unity EventSystem that we can use in any implementations of our game.
Go in the Events ->Player -> OnMove
If we click +, now we can pass what we need for the Event System and implementation.
Just drag and drop Player object inside it, go to Function -> PlayerInputController (or the name you gave to script) and at the top we have OnMove().
Select it and we are raedy to go!
If we test it
Everything works perfectly.
So here’s how the PlayerInput component works.
I honestly don’t know which implementation is better, I think like any feature in Unity, there is a method where you need to write more code and a method where you need to write less code, but at the end of the day, what we want is to understand how it works the system.
Because if we understand the logic behind it, we know how it works. And thanks to this, we can implement it whenever we need it without major problems.
Honestly, I haven’t touched every single implementation, I’ve focused on how it works and how to implement it.
As always feel free to test it, because is the best method to learn how implement and use things.
See you in the next articles!