Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question HELP :((( the new Input System is COMPLETELY ignoring my Keyboard

Discussion in 'Input System' started by unity_vGmHBmVS2Ut0Lw, Jun 1, 2022.

  1. unity_vGmHBmVS2Ut0Lw

    unity_vGmHBmVS2Ut0Lw

    Joined:
    Mar 8, 2021
    Posts:
    1
    Guys, ngl, im completely frustrated!

    Im trying for hours now, to get the new Input System working and I dont know what I did wrong...

    Im using this code:

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.InputSystem;
    5.  
    6. public class PlayerController : MonoBehaviour
    7. {
    8.  
    9.     public Rigidbody2D rb;
    10.     public PlayerInput playerInput;
    11.  
    12.     Vector2 MouseInput;
    13.     Vector2 aimInput;
    14.     Vector2 movementInput;
    15.  
    16.     // Start is called before the first frame update
    17.     void Start()
    18.     {
    19.      
    20.     }
    21.  
    22.     public void GetMovementInput(InputAction.CallbackContext value)
    23.     {
    24.         movementInput = value.ReadValue<Vector2>();
    25.     }
    26.  
    27.     public void GetAimInput(InputAction.CallbackContext value)
    28.     {
    29.         aimInput = value.ReadValue<Vector2>();
    30.         //MouseInput = Camera.main.ScreenToWorldPoint(value.ReadValue<Vector2>()).normalized;
    31.     }
    32.  
    33.     // Update is called once per frame
    34.     void Update()
    35.     {
    36.  
    37.     }
    38.  
    39.     private void FixedUpdate()
    40.     {
    41.         Debug.Log(movementInput);
    42.     }
    43. }

    .. just to debug my Variables. Using a Gamepad is no Problem at all and i can see my changes in the console. But neither my Mouse position nor my key-presses on the keyboard seem to show up. I always get the Vector(0,0). I also checked my Action Assets etc. but everything's fine there. I have two control schemes... one for pc(mouse,keyboard), one for Gamepad controls. Everything has the right binding etc. Even the input debugger notices, when im pressing smth on my keyboard. But the input system itself seems to have an issue there? or did I do smth wrong?

    Edit: I found smth out: The Gamepad immediatly shows up as a paired device, when i use it. The keyboard and the mouse arent. But idk how to pair these devices to my user...any ideas?

    If u need more information to help me, just ask :)

    Thx for ur help :)
     
    Last edited: Jun 1, 2022
  2. simplycabe

    simplycabe

    Joined:
    May 9, 2022
    Posts:
    1
    I'm having a similar problem. I have a composite action MoveAction, Action Type: Value, Control Type: Vector 3, that is supposed to get input from my keyboard and a controller so I can move the camera around, but I'm only getting response from the controller and not the keyboard.

    I have other actions set up that do get keyboard input, so I'm at a loss. It seems like it's just MoveAction that isn't getting triggered.

    What Behavior type are you using for your Player Input? I have mine set to Invoke Unity Events.