Unity выбивает ошибку
Unity выбивает ошибку
Rigidbody2D' does not contain a definition for 'Pozition' and no accessible extension method 'Pozition' accepting a first argument of type 'Rigidbody2D' could be found (are you missing a using directive or an assembly reference?)
Вот код:
using System.Collections.Generic;
using UnityEngine;
public class playercntrl : MonoBehaviour
{
public float speed = 20f;
private Rigidbody2D rb;
void Start()
{
rb = GetComponent <Rigidbody2D> ();
}
// Update is called once per frame
void Update()
{
float moveX = Input.GetAxis ("Horizontal");
rb.MovePozition (rb.Pozition + Vector2.right * moveX * speed * Time.deltaTime );
}
}
Говорит, что ошибка здесь:
rb.MovePozition (rb.Pozition + Vector2.right * moveX * speed * Time.deltaTime );
Я только начал кодить и не понимаю, в чём ошибка. Помогите, пожалуйста.
Ответы (1 шт):
Автор решения: rinan
→ Ссылка
Замените строчку
rb.MovePozition (rb.Pozition + Vector2.right * moveX * speed * Time.deltaTime );
на строчку
rb.MovePosition(rb.Position + Vector2.right * moveX * speed * Time.deltaTime);
Ошибка в слове Position