0
\$\begingroup\$

I'm trying to use the new input system for my 3rd person character in Unity. However, whenever I press the WASD keys, or try to move the camera, nothing happens. I've looked everywhere, but can't find an answer!

Here's a picture of the different values and such. enter image description here

Here's some of my code

using UnityEngine;
using UnityEngine.InputSystem;

public class CharacterController : MonoBehaviour {

    [Header("Mouse Input Settings")]
    public bool cursorLocked = true;
    public bool cursorInputForLook = true;

    public void OnMove(InputValue value)
    {
        Debug.Log("Moving");
        move = value.Get<Vector2>();
    }

    
    public void OnLook(InputValue value)
    {

        Debug.Log("Looking");
        if (cursorInputForLook)
        { 
           look = value.Get<Vector2>();
            
        }
    }

    public void OnJump(InputValue value)
    {
        Debug.Log("Jumping");
        jump = value.isPressed;
    }

    public void OnSprint(InputValue value)
    {
        Debug.Log("Sprinting");
        sprint = value.isPressed;
    }
}

I also have the active input handling turned to both input systems in the projected settings menu. What could I possibly be doing wrong? Is my project just bugged, and I have to just make a new one? Any help would be appreciated!

\$\endgroup\$
2
  • \$\begingroup\$ This looks quite similar to this existing Q&A — did you try applying the answer posted there? \$\endgroup\$
    – DMGregory
    Jun 13, 2023 at 12:22
  • \$\begingroup\$ Yeah I already did, however the console still isn't logging whenever I press the WASD keys or when I try to look around. \$\endgroup\$
    – Johnathan
    Jun 13, 2023 at 19:31

1 Answer 1

1
\$\begingroup\$

I'm just using the documentation as an answer for your case (since I usually do the binding of via code and not the editor)

The binding of your events for player input should be Behaviour: Invoke Unity Events according to the docu. From there you can set the methods you want to call in your character controller.

work flow from the documentation

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .