前提・実現したいこと
public static int[] sv = new int[] { 0, 0, 0, 0};
これを、void Update後 public static int[] sv = new int[] { 1, 1, 1, 0};にする方法が知りたいです。
発生している問題・エラーメッセージ
エラーメッセージ
該当のソースコード
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Pra : MonoBehaviour { bool one; int i; public static int[] sv = new int[] { 0, 0, 0, 0 }; // Start is called before the first frame update void Start() { one = true; } // Update is called once per frame void Update() { if (one) { if (Input.GetKeyDown(KeyCode.Space)) { sv[i] = 1; i = i +1; } if (i == 2) { one = false; } } } }
試したこと
ここに問題に対して試したことを記載してください。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。