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:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerController : MonoBehaviour
{
public Rigidbody2D rb;
public PlayerInput playerInput;
Vector2 MouseInput;
Vector2 aimInput;
Vector2 movementInput;
// Start is called before the first frame update
void Start()
{
}
public void GetMovementInput(InputAction.CallbackContext value)
{
movementInput = value.ReadValue<Vector2>();
}
public void GetAimInput(InputAction.CallbackContext value)
{
aimInput = value.ReadValue<Vector2>();
//MouseInput = Camera.main.ScreenToWorldPoint(value.ReadValue<Vector2>()).normalized;
}
// Update is called once per frame
void Update()
{
}
private void FixedUpdate()
{
Debug.Log(movementInput);
}
}
… 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 ![]()