Assets\Scripts\Player.cs(8,5): error CS0246: The type or namespace name 'SerializeFiled' could not be found (are you missing a using directive or an assembly reference?) using System.Collections; using System.Collections.Generic; using UnityEngine;
В сообщении написано, что пространства имен SerializeField не существует, но вы почему-то используете его для объявления переменной movingSpeed. Удалите [SerializeField]
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
[SerializeFiled] private float movingSpeed = 10f;
private Rigidbody2D rb;
private void Awake() {
rb = GetComponent<Rigidbody2D>();
if (rb == null) {
Debug.LogError("Rigidbody2D не найден на объекте Player");
}
}
private void FixedUpdate() {
if (rb == null) return;
Vector2 inputVector = new Vector2(0, 0);
if (Input.GetKey(KeyCode.W)) {
inputVector.y = 1f;
}
if (Input.GetKey(KeyCode.S)) {
inputVector.y = -1f;
}
if (Input.GetKey(KeyCode.A)) {
inputVector.x = -1f; // Исправлено направление движения по оси X
}
if (Input.GetKey(KeyCode.D)) {
inputVector.x = 1f;
}
rb.MovePosition(rb.position + inputVector * (movingSpeed * Time.fixedDeltaTime));
}
}