Не могу заставить двигаться 2д игрока в Unity
скрипт движения:
using UnityEngine;
using UnityEngine.InputSystem;
public class MovmentPlayer : MonoBehaviour
{
public float movementSpeed = 5f;
private Rigidbody2D rb;
private void Start()
{
rb = GetComponent<Rigidbody2D>();
}
private void Update()
{
float moveX = Input.GetAxis("Horizontal");
float moveY = Input.GetAxis("Vertical");
Vector2 movement = new Vector2 (moveX, moveY) * movementSpeed * Time.deltaTime;
rb.MovePosition(rb.position + movement);
}
}
ошибка в консоли
InvalidOperationException: You are trying to read Input using the UnityEngine.Input class, but you have switched active Input handling to Input System package in Player Settings. UnityEngine.Internal.InputUnsafeUtility.GetAxis (System.String axisName) (at :0) UnityEngine.Input.GetAxis (System.String axisName) (at :0) MovmentPlayer.Update () (at Assets/Scripts/MovmentPlayer.cs:16)
на обьекте стоит Rigidbody 2d kinematic