前提・実現したいこと
構造体の中にある配列を使った条件式書いているときに以下のエラーが発生しました。解決策を教えてください。
発生している問題・エラーメッセージ
NullReferenceException: Object reference not set to an instance of an object serect2.Update () (at Assets/scripts/serect2.cs:57)
該当のソースコード
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; public class serect2 : MonoBehaviour { public int scturn2 = 1; public int cs2 = 1; public int muzu; public kouzoutai kouzoutai; // Start is called before the first frame update void Start() {// Debug.Log(cs2); }// // Update is called once per frame void Update() { status bp1 = kouzoutai.bp1; int i; if (scturn2 == 1) { //Random.Range(-1, 3) if (Input.GetKeyDown("return")) { cs2 = cs2 % 3; muzu = cs2; scturn2 += 1; cs2 = 0; } } if (scturn2 == 2) { for(i=0;bp1.cbuki[i]==0 ; i++)/*ココ*/ { cs2++; } } } }
補足情報(FW/ツールのバージョンなど)
/ココ/と書かれているところがエラーの所です

回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/03/12 06:52