NEW INPUT SYSTEM in Unity

Brackeys · 703K views · 2018 · 17:04

Open on YouTube

Game programming & enginesIndie game developmenttutorialdated

Why Stack Overflow recommends it

Stack Overflow users link it when answering questions about getting started with Unity's new Input System and defining input actions.

Recommended by 3 people across 3 different months, 2019 to 2022.

What it is

A Brackeys tutorial from late 2018 walking through Unity's then-new Input System package, including how to set up input actions and bind them to controls. It is a screen-recorded walkthrough aimed at Unity game developers.

What people said

Recommends IndieGameDev · 2020-08 · Stack Overflow · on “how to program player movement with new unity input system”

I would just search you find a lot of good tutorials that explains he basics of the new Unity Input System. Here as an example a Video of Brackeys which makes in my opinion some of the best unity tutorials available for free [this video]

Recommends Hakan Çolakoğlu · 2021-03 · Stack Overflow · on “Unity Input System mouse button hold and drag”

So as I always create c# script of the new input system and use it, your method is a bit unusual for me but I had the same problem. It appeared to me that Unity doesn't have a "hold" or keep pressing something feature in the new system. But what it has 3 different states for an action as performed, canceled and completed. bool pressed = false; SetPan.performed += ctx => pressed = true; SetPan.canceled += ctx => pressed = false; Say you click with your mouse, than your action will be first "performed" which will make a bool true AND it will stay true forever if you don't set it to false again. So you can use this bool value to determine you are still holding the button so you can drag your mo

Recommends FreezeBee · 2022-04 · Stack Overflow · on “when button pressed event happens using unity input system”

You guessed right if you didn't declare InputManager anywhere in your code. In order to use new input system you need to define input actions (which Brackeys described pretty well here [this video] ). If you need simlpe solution you can use old input system and check whether specific key was pressed like this if (Input.GetKeyDown("space")) - Unity documentation [LINK] , but I really recommend checking out new input system cos it's gonna be better in the long run

Cites Curtwagner1984 · 2019-05 · Stack Overflow · on “Unity3d New Input System(2.8), can't reference Input Action in the editor”

I've just updated to the new Input System from 2.7 to 2.8. How the new Input System works is you create an input actions asset by going to Create-> Input Actions [LINK] . This creates an asset where actions can be mapped to keys. One then create a C# script from this asset and use it in their code. Which is what I did. I called the Asset MyInput.inputactions and the C# script is MyInput.cs [LINK] When you use the generated C# script this way you need to reference the asset in your script. However, after the update, it seems this is impossible to do from the editor. When I define a public MyInput variable in my class, like so: public class ShapeMover: MonoBehaviour { public MyInput controls;