- Home /
How do I fix the error in my Player Controller?
Here's the code I wrote for my character controller:
using UnityEngine;
using System.Collections;
public class FirstPersonController : MonoBehaviour {
public float movementSpeed = 5.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
float forwardSpeed = Input.GetAxis("Verical") * movementSpeed;
float sideSpeed = Input.GetAxis("Horizontal") * movementSpeed;
Vector3 speed = new Vector3( sideSpeed, 0, forwardSpeed );
CharacterController cc = GetComponent<CharacterController>();
cc.SimpleMove( speed );
}
}
And when I try to move my character I can't move and I get this error:
UnityException: Input Axis Vertical is not setup. To change the imput setting use: Edit -> Project Settings -> Input FirstPersonController.Update () (at Assets/Script/FirstPersonController.cs:16)
Can you help me fix my problem.
Please fix your code so that it is formatted correctly.
Thank you , this was very helpful i appreciate it , I had the same problem
Answer by amphoterik · Jul 16, 2013 at 01:50 PM
You spelled vertical wrong. It is this:
float forwardSpeed = Input.GetAxis("Verical") * movementSpeed;
It should be this:
float forwardSpeed = Input.GetAxis("Vertical") * movementSpeed;
Heh, sorry. To be fair, I cheated. I am the one that published this from moderation so I knew it was co$$anonymous$$g :)
If this answered your question, please select it as the answer. It helps future viewers and gives you karma as well.
Answer by InfiniBuzz · Jul 16, 2013 at 01:51 PM
you have a typo in:
float forwardSpeed = Input.GetAxis("Verical") * movementSpeed;
is this right in your original script? change "Verical" to "Vertical":
float forwardSpeed = Input.GetAxis("Vertical") * movementSpeed;
it should be setup by default if not, do what the error tells you ;)
O$$anonymous$$ please tick @amphoterik's answer as correct (he was faster;) ). This will help ppl with the same problem and noone wastes time reading this if its already solved.
Your answer
![](https://koobas.hobune.stream/wayback/20220613110219im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
MMD How to export model and animations to Unity as 3rd person controller? 2 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Torque forces or Quaternion transforms for hovercraft rotations? 2 Answers
Referencing an object from one script to another, script reference doesn't help :/ 0 Answers
Only activate scripts when game is toggled to the first person controller 1 Answer