error CS0029: Cannot implizit convert type `int' to `bool' - Unity3D

Bekam ich Fehler CS0029: Cannot implicitly convert type int to bool error.

Hier ist mein code :

using UnityEngine;
using System.Collections;

public class card2 : MonoBehaviour {

public GUISkin MenuSkin;

public int cardinpuani;
public float sekiz = 8;
public float sifir = 0;
public int onalti = 16;
public int dort = 4;
public int yirmi =20;
public int oniki = 12;
public int yirmidort = 24;
public int yirmisekiz = 28;
public bool clicked = false;

void Start () {

}

void Update () {
}

void OnGUI () {

    GUI.skin = MenuSkin;

    if(GUI.Button ( new Rect (0,Screen.height-50,100,50), "No")){
        Application.LoadLevel(4);
    }
    else if(GUI.Button ( new Rect (Screen.width-100,Screen.height-50,100,50), "Yes")){
    clicked = true;
    }
    else if(clicked=true){
        if(sifir = PlayerPrefs.GetFloat("tahmin", sifir)){
            PlayerPrefs.SetFloat("tahmin", sekiz);
            Application.LoadLevel(4);
        }
    }


    /*if(sifir = PlayerPrefs.GetInt("tahmin")){
        PlayerPrefs.SetInt("tahmin", sekiz);
        if(3>1){
        Application.LoadLevel(4);
        }}

        else if(dort = PlayerPrefs.GetInt("tahmin")){
        PlayerPrefs.SetInt("tahmin", oniki);
        Application.LoadLevel(4);
        }
        else if(onalti = PlayerPrefs.GetInt("tahmin")){
        PlayerPrefs.SetInt("tahmin", yirmidort);
        Application.LoadLevel(4);
        }
        else if(yirmi = PlayerPrefs.GetInt("tahmin")){
            PlayerPrefs.SetInt("tahmin", yirmisekiz);
            Application.LoadLevel(4);
        }*/

        //PlayerPrefs.SetInt("tahmin", sekiz);

        //Application.LoadLevel(4);


}
}

Es ist einfacher code, aber ich bin noch immer Fehler. Ich habe versucht, den kommentierten code auch, aber nicht gelungen, bei der Lösung des Problems. Jegliche Hilfe.

  • Sie sollten mit == für den Vergleich in if Anweisung, anstelle von einzelnen =
  • Omg vielen Dank 😀
Schreibe einen Kommentar