Unity new Input System : Player Input Component (Part XIII)

Matteo Lo Piccolo
3 min readJan 6, 2022

--

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!

--

--

Matteo Lo Piccolo
Matteo Lo Piccolo

Written by Matteo Lo Piccolo

Always in love with programming, even if late (I'm already 39 years old) I decided to follow my dream! We will see how far my passion will take me!

No responses yet