When creating controls for your players to use, It's needed (or really just helpful) that you modify your Input settings.
Start with Edit>Project Settings>Input. There it will show all the components of the Input Manager in the Inspector Pane. Under Axes contains all the different inputs that can be used (and modified) in your game. Right under Axes is the size of your Input options. Depending on your type of game, you might need more than just the default setting of 17 different input options. To do this, click on the number to the right of size, and change it to your needed number
The name property of your Input is what defines it. You can reference it in script with name. Like:
if(Input.GetButtonDown("Jump")){
//code here
}
Descriptive Name - describes the positive buttons function.
Descriptive Negative Name - defines the negative button function.
Positive Button - Sends a positive value to the axis.
Negative Button - Sends negative value to the axis. (what a surprise...)
Alt Buttons - Alternative to using Positive and Negative Buttons.
Read more HERE.
If your using an axis just as a fire button, there really is no point setting negative buttons.
So you've done everything right, you got your scripts, your Input Manager set, well theres still one thing. You need character controls. To do this, first click on your character in your Hierarchy Pane. Then go to Component>Physics>Character Controller. Just click on that and then It will be added! that simple!
Comments
Post a Comment