CS1061: "PlayerInputActions" не содержит определения "Player" (Unity/C#)
Только начал изучение Unity. Пару дней назад написал ровно такой же код. Всё работало корректно. Сегодня решил освежить память и переписать его заново, однако на этот раз компилятор выдает ошибку.
using UnityEngine;
public class Player : MonoBehaviour
{
[SerializeField] private float movingSpeed = 10f;
private Rigidbody2D rigidbody2;
private PlayerInputActions playerInputActions;
private void Awake()
{
rigidbody2 = GetComponent<Rigidbody2D>();
playerInputActions = new PlayerInputActions();
playerInputActions.Enable();
}
private Vector2 GetMovementActions()
{
Vector2 inputVector = playerInputActions.Player.Move.ReadValue<Vector2>();
return inputVector;
}
void Update()
{
Vector2 inputVector = GetMovementActions();
inputVector = inputVector.normalized;
rigidbody2.MovePosition(rigidbody2.position + inputVector * Time.fixedDeltaTime * movingSpeed);
}
}
Код ошибки: CS1061
Описание: "PlayerInputActions" не содержит определения "Player", и не удалось найти доступный метод расширения "Player", принимающий тип "PlayerInputActions" в качестве первого аргумента (возможно, пропущена директива using или ссылка на сборку).