using UnityEngine; using UnityEngine.InputSystem; namespace ArcadeVP { public class InputManager_ArcadeVP : MonoBehaviour { public ArcadeVehicleController arcadeVehicleController; [HideInInspector] public float horizontal; [HideInInspector] public float vertical; [HideInInspector] public float jump; private PlayerInput _playerInput; private InputAction _steerAction; private InputAction _accelAction; private InputAction _brakeAction; private void Awake() { _playerInput = GetComponent(); if (_playerInput == null) { Debug.LogError("PlayerInput component not found on the GameObject."); return; } _steerAction = _playerInput.actions["Steer"]; _accelAction = _playerInput.actions["Accelerate"]; _brakeAction = _playerInput.actions["HandBrake"]; } private void Update() { horizontal = _steerAction?.ReadValue() ?? 0f; vertical = _accelAction?.ReadValue() ?? 0f; jump = _brakeAction?.ReadValue() ?? 0f; arcadeVehicleController.ProvideInputs(horizontal, vertical, jump); } } }