Vector3 vektor satırı niye hata veriyor?

krekeas

Decapat
Katılım
5 Şubat 2023
Mesajlar
633
Çözümler
3
Daha fazla  
Cinsiyet
Erkek
Vector3 vektor = New Vector3(yatay, 0, dikey);

Bu satır C# ile VS Code uzerinden yazıyorum. İzledigim adamda hata vermiyor ama bende hata veriyor. Sebebini anlamadım. İsterseniz tüm kodu atabilirim.
 
Son düzenleyen: Moderatör:
Vector3 vektor = New Vector3(yatay, 0, dikey);

Bu satır C# ile VS Code uzerinden yazıyorum. İzledigim adamda hata vermiyor ama bende hata veriyor. Sebebini anlamadım. İsterseniz tüm kodu atabilirim.
Aynı kod olduğuna emin misin ? "new'' şeklinde yazman gerek ama tahminimce otomatik düzeltme yüzünden böyle oldu. Tam kodu at ve hatanında ne olduğunu söyle.
 
cozdum hocam yukarda
using System.Numerics adlı bir kütüphane vardı onu sildim duzeldi ama sebebini anlamadım o kutuphane olunca neden hata verdi?
Kodun tam hali;

using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using UnityEngine;
public class TopControl : MonoBehaviour
{
public Rigidbody rb;
public int hiz;
void Start()
{
rb = GetComponent<Rigidbody>();

}

void FixedUpdate()
{

float yatay = Input.GetAxis("Horizontal");
float dikey = Input.GetAxis("Vertical");

Vector3 vektor = new Vector3(yatay,0,dikey);
rb.AddForce(vektor*hiz);

}
}
 
cozdum hocam yukarda
using System.Numerics adlı bir kütüphane vardı onu sildim duzeldi ama sebebini anlamadım o kutuphane olunca neden hata verdi?
Kodun tam hali;

using System.Collections;
using System.Collections.Generic;
using System.Numerics;
using UnityEngine;
public class TopControl : MonoBehaviour
{
public Rigidbody rb;
public int hiz;
void Start()
{
rb = GetComponent<Rigidbody>();

}

void FixedUpdate()
{

float yatay = Input.GetAxis("Horizontal");
float dikey = Input.GetAxis("Vertical");

Vector3 vektor = new Vector3(yatay,0,dikey);
rb.AddForce(vektor*hiz);

}
}
Vector3 Struct (System.Numerics) bunun sebebi kullandığın kütüphanede Vector3 olması.
 

Technopat Haberler

Geri
Yukarı