How do i setup this thing, i need to go to Input Manager?
If your post title contains the actual error, you have misspelled “Vertical”.
If you have it spelled and capitalized correctly, then yes, Input Manager is where you’d set that up. However, Unity projects come with many axes set up by default, including “Vertical” and “Horizontal”, so it’s probably already there, and typos are more common.
If you’re still not sure, paste the actual code, the exact error, and a screenshot of the Input Manager.
you have discord? maybe we could discuss that there, and will be easier for me to send the prints
lol no that’s not gonna happen. Post here.
![]()
Yeah, like I said, you’ve misspelled “Vertical” in your code.
so i’m terrible at typing
Make sure your code uses the EXACT spelling and CAPITALIZATION for the axis name in the input manager (hint: currently your code does not). Better yet, just copy and paste it.
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Security.Cryptography;
using System.Threading;
using UnityEngine;
[RequireComponent(typeof(Rigidbody))]
public class PlayerController : MonoBehaviour
{
public bool enableMouse;
[Header("PlayerConfig")]
public string PlayerName;
public int Life;
public float speed;
public float RunSpeed;
public float sensitivity;
[Header("Imports")]
public Camera cam;
//Private
private Rigidbody rb;
private float realSpeed;
private Vector3 velocity;
private Vector3 rotation;
private Vector3 camRotation;
private float rotCam;
void Start()
{
rb = GetComponent<Rigidbody>();
}
void Update()
{
#region Movement
float _xMov = Input.GetAxisRaw("Horizontal");
float _yMov = Input.GetAxisRaw("Vertical");
if (Input.GetButton("Run") == true && _xMov == 0 && _yMov == 1)
{
realSpeed = RunSpeed;
}
else
{
realSpeed = speed;
}
Vector3 _MoveHorizontal = transform.right * _xMov;
Vector3 _MoveVertical = transform.forward * _yMov;
velocity = (_MoveHorizontal + _MoveVertical).normalized * realSpeed;
#endregion
#region Rotation
float _yMouse = Input.GetAxisRaw("Mouse x");
rotation = new Vector3(0, _yMouse, 0) * sensitivity;
float _xMouse = Input.GetAxisRaw("Mouse y");
camRotation = new Vector3(_xMouse, 0, 0) * sensitivity;
#endregion
#region enableMouse
if (enableMouse)
{
Cursor.lockState = CursorLockMode.Locked;
Cursor.visible = false;
}
else
{
Cursor.lockState = CursorLockMode.None;
Cursor.visible = false;
}
#endregion
}
private void FixedUpdate()
{
if (enableMouse == true)
{
Moviment();
Rotation();
}
}
void Moviment()
{
if (velocity != Vector3.zero)
rb.MovePosition(rb.position + velocity * Time.deltaTime);
}
void Rotation()
{
rb.MoveRotation(rb.rotation * Quaternion.Euler(rotation));
if (cam != null)
{
rotCam += camRotation.x;
rotCam = Mathf.Clamp(rotCam, -80, 80);
cam.transform.localEulerAngles = new Vector3(-rotCam, 0, 0);
}
}
}
here’s the code again…
I don’t need to see the code. Again, double check your capitalization.
capitalization?
This is a lowercase letter: “x”
This is a capital letter: “X”
oh, CAPS
so i need to put “mouse X”?
Just copy the name of the axis PRECISELY AS IT APPEARS IN THE INPUT MANAGER.
now i fixed

