Unity'de yazılan koddaki hata nerede?

The_Solita

Yoctopat
Katılım
31 Ekim 2021
Mesajlar
1
Daha fazla  
Cinsiyet
Kadın
Using System. Collections;
Using System. Collections. Generic;
Using unityengine;
Public class playermovement: Monobehaviour.
{
Rigidbody2D RGB;
Vector3 velocity;
Float speedamount = 5F;
// Start is called before the first frame Update.
Void Start()
{
RGB = GetComponent<Rigidbody2D>();
}
// Update is called once per frame.
Void Update()
{
Velocity = New Vector3(ınput. Getaxis("horizontal"), of);
Transform. Position += velocity * speedamount * time. Deltatime;
}
}

Hatam olan kısmı of diye göstermekte Unity'e yeni başladım ne yapmalıyım?
 
Bu script dosyasının adını PlayerMovement olarak değiştir.
Edit: Kütüphanenin adı da yanlışmış onu düzelttim.

C#:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : Monobehaviour
{
    Rigidbody2D RGB;
    Vector2 velocity;
    float speedamount = 5f;
    // Start is called before the first frame Update.
    void Start()
    {
        RGB = GetComponent<Rigidbody2D>();
    }
    // Update is called once per frame.
    void Update()
    {
        velocity = new Vector2(Input.Getaxis("Horizontal"), 0f);
        velocity = velocity * (speedamount * Time.deltaTime);
        RGB.velocity = velocity;
    }
}
 
Son düzenleme:
Using System. Collections;
Using System. Collections. Generic;
Using unityengine;
Public class playermovement: Monobehaviour.
{
Rigidbody2D RGB;
Vector3 velocity;
Float speedamount = 5F;
// Start is called before the first frame Update.
Void Start()
{
RGB = GetComponent<Rigidbody2D>();
}
// Update is called once per frame.
Void Update()
{
Velocity = New Vector3(ınput. Getaxis("horizontal"), of);
Transform. Position += velocity * speedamount * time. Deltatime;
}
}

Hatam olan kısmı of diye göstermekte Unity'e yeni başladım ne yapmalıyım?

Hocam Vector 3 oluşturursanız 3 değer eklemeniz gerekmektedir. Vector2 oluşturursanız sadece 2 değer eklemeniz yeterli olur.
 
Uyarı! Bu konu 5 yıl önce açıldı.
Muhtemelen daha fazla tartışma gerekli değildir ki bu durumda yeni bir konu başlatmayı öneririz. Eğer yine de cevabınızın gerekli olduğunu düşünüyorsanız buna rağmen cevap verebilirsiniz.

Technopat Haberler

Yeni konular

Geri
Yukarı