The very first step is to create the C# class that will calculate the input from the player. To start, open Unity with the following steps:
Right-click on the Assets folder and select Create and then Folder:
I named my folder
Scripts
; you can give it any name you like, although I recommend something that keeps you organized.When this folder is created, right-click on it. Then, navigate to Create and select C# Class.
You can again name this what you like; I chose
PlayerInput
.
Unity ships with its own Integrated Development
Environment (IDE) called MonoDevelop. When you double-click on PlayerInput
, this is what will open.
Tip
If you want to use a different IDE, you can do so by navigating to Edit | Preferences | External Tools and changing External Script Editor to something of your choice.
Now, double-click on PlayerInput.
When PlayerInput opens, it will have a default structure that Unity uses for classes created in the engine, as shown in the following code:
using UnityEngine...