Assets\Scripts\Player.cs(22,50): error CS1061: 'PlayerInputActions'
Assets\Scripts\Player.cs(22,50): error CS1061: 'PlayerInputActions' does not contain a definition for 'Players' and no accessible extension method 'Players' accepting a first argument of type 'PlayerInputActions' could be found (are you missing a using directive or an assembly reference?)
////
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
[SerializeField] private float movingSpeed = 10f;
private PlayerInputActions playerInputActions;
private Rigidbody2D rb;
private void Awake()
{
rb = GetComponent<Rigidbody2D>();
playerInputActions = new PlayerInputActions();
playerInputActions.Enable();
}
private Vector2 GetMovementVector()
{
Vector2 inputVector = playerInputActions.Players.Move.ReadValue<Vector2>();
return inputVector;
}
private void FixedUpdate()
{
Vector2 inputVector = GetMovementVector();
inputVector = inputVector.normalized;
rb.MovePosition(rb.position + inputVector * (movingSpeed * Time.fixedDeltaTime));
}
}
Ошибка говорит, что у `PlayerInputActions` нет определения для `Players`. Возможно, опечатка в названии. Проверь, правильно ли ты написал имя действий. Например, может быть `Player` вместо `Players`.