Я пытаюсь добавить скрипт в спрайт Player, но Unity выдает мне эту ошибку, вы можете мне помочь?
using System.Collections;
using UnityEngine;
[RequireComponent (typeof (RigidBody2D))]
public class PlayerMovement : MonoBehaviour
{
RigidBody2D body;
//Upgradable Variables
float moveSpeed = 3f;
// Start is called before the first frame update
void Start () {
body = GetComponent<RigidBody2D>();
}
// Update is called once per frame
void Update () {
Movement();
}
void Movement()
{
float h = Input.GetAxis("Horizontal");
Vector2 velocity = new Vector2(Vector2.right.x * moveSpeed * h, body.velocity.y);
body.velocity = velocity;
}
}