前提・実現したいこと
Cannot implicitly convert type int' to
bool'というエラーが出てるのですがエラー
を直したいです
ここに質問の内容を詳しく書いてください。
(例)PHP(CakePHP)で●●なシステムを作っています。
■■な機能を実装中に以下のエラーメッセージが発生しました。
Unityで『sucoaが13になったとき、clearと表示する』システムを作っているのですが
そのプログラムを書いたところエラーが発生しました。(30行目)
発生している問題・エラーメッセージ
Cannot implicitly convert type int' to
bool'
エラーメッセージ Cannot implicitly convert type `int' to `bool'
該当のソースコード
ソースコード using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Santa : MonoBehaviour { float Sucoa; public Text sampleText; int sucoa; // Use this for initialization void Start () { } // Update is called once per frame void Update () { if (Input.GetKey (KeyCode.W)) { transform.Translate (0f, 0f, 5f * Time.deltaTime); } if (Input.GetKey (KeyCode.S)) { transform.Translate (0f, 0f, -5f * Time.deltaTime); } if (Input.GetKey (KeyCode.A)) { transform.Rotate (0f,-15f * Time.deltaTime, 0f); } if (Input.GetKey (KeyCode.D)) { transform.Rotate (0f, 15f * Time.deltaTime, 0f); } sampleText.text = "sucoa"; if (sucoa = 13){ sampleText.text = "Clear"; } } void OnCollisiEnter (Collision col){ if (col.gameObject.name == "PresentBox(1)") { Sucoa++; } if (col.gameObject.name == "PresentBox(2)") { Sucoa++; } if (col.gameObject.name == "PresentBox(3)") { Sucoa++; } if (col.gameObject.name == "PresentBox(4)") { Sucoa++; } if (col.gameObject.name == "PresentBox(5)") { Sucoa++; } if (col.gameObject.name == "PresentBox(6)") { Sucoa++; } if (col.gameObject.name == "PresentBox(7)") { Sucoa++; } if (col.gameObject.name == "PresentBox(8)") { Sucoa++; } if (col.gameObject.name == "PresentBox(9)") { Sucoa++; } if (col.gameObject.name == "PresentBox(10)") { Sucoa++; } } }
試したこと
色々と変数を変えたのですがエラーが発生しました
補足情報(FW/ツールのバージョンなど)
MonoDeveop Version 5.9.6
ここにより詳細な情報を記載してください。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。