Good evening.
Currently I’m trying to create a first person controller setup that utilizes an Xbox controller. However, I am mapping it as a generic Gamepad. This is my first time using the new input system in Unity. The controller is functioning properly in the input debugger but in regard to the scripts, nothing is happening.
using System.Collections;
using System.Collections.Generic;
using UnityEngine.InputSystem;
using UnityEngine;
public class FPC_GamePad : MonoBehaviour
{
public InputActionAsset playerController;
private InputAction leftstick;
public Vector2 joyAxis;
public Vector2 n;
InputActionMap movementActionMap;
void Awake(){
playerController.Enable();
movementActionMap = playerController.FindActionMap("Movement");
leftstick = movementActionMap.FindAction("Left_Stick");
leftstick.performed += leftStickPerformed;
}
void leftStickPerformed(InputAction.CallbackContext context){
joyAxis = leftstick.ReadValue<Vector2>();
}
void Update(){
n = new Vector2(joyAxis.x, joyAxis.y) * Time.deltaTime;
gameObject.transform.Translate(n, Space.World);
}
}
The only reason the public vector2 joyAxis exists is so I can attempt to see if the joystick movement from the gamepad is converting properly to a vector2, which it isn’t. I’m getting absolutely no response to anything I do, regardless of what settings I change. Is there something that I am missing or not doing correctly?