Çözüldü C# Unity'de köşeli parantez hatası

Bu konu çözüldü olarak işaretlenmiştir. Çözülmediğini düşünüyorsanız konuyu rapor edebilirsiniz.

ALKAR396

Hectopat
Katılım
27 Ocak 2021
Mesajlar
448
Çözümler
1
Unity'de oyun yapıyorum, bu kodları yazıyorum. Köşeli parantez hatası veriyor, bakar mısınız?

[CODE title="Kod"]using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BirdScript : MonoBehaviour {

public static BirdScript instance;


[SerializeField]

private Rigidbody2D MyRigidbody;

[SerializeField]

private Animator Anim;

private float Speed= 3f;

private float BounceSpeed= 4f;

private bool didFlap;

public bool isAlive;



void Awake(){
if(instance==null){
instance=this;
}

isAlive=true;

}


// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void FixedUpdate(){
if(isAlive){
Vector3 temp =transform.position;
temp.x+=Speed*Time.deltaTime;
transform.position=temp;
if(didFlap){
didFlap=false;
MyRigidbody.velocity=new Vector2(0,BounceSpeed);
Anim.SetTrigger("flap");
}if(MyRigidbody.velocity.y>=0){
transform.rotation=Queternion.Euler(0,0,0);

}else{


float angle=0;
angle=Mathf.Lerp(0,-90,-MyRigidbody.velocity.y/7);
transform.rotation=Quaternion.Euler(0,0,angle)
}
}

public void uc(){
didFlap=true;
}





}
[/CODE]
 
Çözüm
Eki Görüntüle 1244461

Bak burada ";" eksil transfırm kodunda dener misin?

Düzenledim kodumu bu dediğimi yap ve kodun en altında koy.
Kod:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BirdScript : MonoBehaviour
{

    public static BirdScript instance;


    [SerializeField]

    private Rigidbody2D MyRigidbody;

    [SerializeField]

    private Animator Anim;

    private float Speed = 3f;

    private float BounceSpeed = 4f;

    private bool didFlap;

    public bool isAlive;



    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        isAlive = true;

    }


    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void FixedUpdate()
    {
        if (isAlive)
        {
            Vector3 temp = transform.position;
            temp.x += Speed * Time.deltaTime;
            transform.position = temp;
            if (didFlap)
            {
                didFlap = false;
                MyRigidbody.velocity = new Vector2(0, BounceSpeed);
                Anim.SetTrigger("flap");
            }
            if (MyRigidbody.velocity.y >= 0)
            {
                transform.rotation = Queternion.Euler(0, 0, 0);

            }
            else
            {


                float angle = 0;
                angle = Mathf.Lerp(0, -90, -MyRigidbody.velocity.y / 7);
                transform.rotation = Quaternion.Euler(0, 0, angle);
            }
        }

    }

    public void uc()
        {
            didFlap = true;
        }





}

bunu dener misin. Ayrıcı kodu "Quaternion" olarak değiştir onu da yanlış yazmışsın.
Eki Görüntüle 1244461

Bak burada ";" eksil transfırm kodunda dener misin?

Düzenledim kodumu bu dediğimi yap ve kodun en altında koy.
Kod:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BirdScript : MonoBehaviour
{

    public static BirdScript instance;


    [SerializeField]

    private Rigidbody2D MyRigidbody;

    [SerializeField]

    private Animator Anim;

    private float Speed = 3f;

    private float BounceSpeed = 4f;

    private bool didFlap;

    public bool isAlive;



    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        isAlive = true;

    }


    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void FixedUpdate()
    {
        if (isAlive)
        {
            Vector3 temp = transform.position;
            temp.x += Speed * Time.deltaTime;
            transform.position = temp;
            if (didFlap)
            {
                didFlap = false;
                MyRigidbody.velocity = new Vector2(0, BounceSpeed);
                Anim.SetTrigger("flap");
            }
            if (MyRigidbody.velocity.y >= 0)
            {
                transform.rotation = Queternion.Euler(0, 0, 0);

            }
            else
            {


                float angle = 0;
                angle = Mathf.Lerp(0, -90, -MyRigidbody.velocity.y / 7);
                transform.rotation = Quaternion.Euler(0, 0, angle);
            }
        }

    }

    public void uc()
        {
            didFlap = true;
        }





}

bunu dener misin. Ayrıcı kodu "Quaternion" olarak değiştir onu da yanlış yazmışsın.
 
Çözüm
Tamam
 
Sağolun hocam ya.
 
Bu siteyi kullanmak için çerezler gereklidir. Siteyi kullanmaya devam etmek için çerezleri kabul etmelisiniz. Daha Fazlasını Öğren.…