using UnityEngine; public class PlayerController : MonoBehaviour { [SerializeField] private PlayerMove playerMove; [SerializeField] private CameraMove cameraMove; private InputSystem_Actions _inputActions; private void Awake() { _inputActions = new InputSystem_Actions(); } private void OnEnable() { _inputActions.Player.Enable(); } private void OnDisable() { _inputActions.Player.Disable(); } private void Update() { var moveInput = _inputActions.Player.Move.ReadValue(); var lookInput = _inputActions.Player.Look.ReadValue(); cameraMove.Look(lookInput); var direction = cameraMove.PlanarForward * moveInput.y + cameraMove.PlanarRight * moveInput.x; direction = Vector3.ClampMagnitude(direction, 1f); playerMove.Move(direction); } }