This is my code:
public class NewBehaviourScript : MonoBehaviour {
public float movementspeed = 5.0f;
public float MouseSensitivity = 5.0f;
public float JumpSpeed = 20.0f;
float verticalrotation = 0f;
public float UpDownRange = 60.0f;
float verticalvelocity = 0f;
// Use this for initialization
void Start () {
//this hides the mouse
Screen.lockCursor = true;
}
// Update is called once per frame
void Update () {
//Movement with mouse across screen
float rotleftright = Input.GetAxis ("Mouse X")*MouseSensitivity;
transform.Rotate(0.0f ,rotleftright,0.0f);
//movement of mouse up and down
verticalrotation -= Input.GetAxis ("Mouse Y") * MouseSensitivity;
verticalrotation = Mathf.Clamp (verticalrotation, -UpDownRange, UpDownRange);
Camera.main.transform.localRotation = Quaternion.Euler(verticalrotation, 0, 0);
// This is all movement coding
float ForwardSpeed = Input.GetAxis("Vertical")* movementspeed;
float sidespeed = Input.GetAxis("Horizontal")* movementspeed;
verticalvelocity += Physics.gravity.y * Time.deltaTime;
if (Input.GetButtonDown ("jump")) {
verticalvelocity = JumpSpeed;
}
Vector3 speed = new Vector3 (sidespeed, verticalvelocity, ForwardSpeed);
CharacterController cc = GetComponent<CharacterController>();
speed = transform.rotation * speed;
cc.Move(speed * Time.deltaTime );
}
This is the error message that pops up:
UnityException: Input Button jump is not setup.
To change the input settings use: Edit → Project Settings → Input
NewBehaviourScript.Update () (at Assets/Scripts/NewBehaviourScript.cs:36)
Could someone please tell me how to sort this problem out in basic terms for me ![]()