Im using a PlayerInput module on the player, and i use the mode: invoke unity events
then i use this script on the player.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerController : MonoBehaviour
{
Vector2 readOnMoveInput;
Vector3 moveDirection;
private void Update()
{
moveDirection = new Vector3(readOnMoveInput.x, readOnMoveInput.y, 0);
// Use movedirection to move player
}
public void OnMove(InputAction.CallbackContext context)
{
readOnMoveInput = context.ReadValue<Vector2>();
print(context.ReadValue<Vector2>());
}
public void OnFire(InputAction.CallbackContext context)
{
// Fire Function goes here
print("FIRE!!!");
}
}