Save the document and then maximize or select Unity. This will force the editor to compile the code that we have just written.
On the left-hand side of the editor in the Hierarchy tab, right-click and select Create Empty. This will add a blank GameObject to the scene.
Right-click on the GameObject that we just created and select Rename. Name it
Input
.While still having the
Input
GameObject selected, look to the right-hand side of the screen in Inspector and click on Add Component.When the search window pops up, enter the first half of what you called your input class. For example, when I enter
player
, my Player Input class will appear in the list:Click on your input class to add it to the
Input
GameObject. If everything goes according to plan, you will see the component added and SwipeTime and SwipeDistance both set to0
. Alternatively, you can add theInput
component to GameObject by left-clicking, holding, and dragging it onto GameObject in the Hierarchy tab...