unityで教育用のゲームを作ろうと思うのですが、上下にアトランダムに出現した箱の数を
数えさせる単純なゲームです。
箱は出現出来ましたが、プレイヤーがゲーム中その数をキーボードで打ち込んでその数をパソコン入力する関数がわかりません。
###該当のソースコード
using UnityEngine;
using System.Collections;
public class Stage : MonoBehaviour {
public GameObject CubePrefab; public GameObject CubePrefab1; public int number1=0; public int number2=0; // Use this for initialization void Start (){ //GameObject[] obj = new GameObject[10]; int no = Random.Range (1, 5); number1=no; for (int i = -5; i < 5-(10-no); i++) Instantiate (CubePrefab, new Vector3 (i*2,0,0), Quaternion.identity); int nu = Random.Range (1, 5); number2=nu; for (int j = -5; j < 5-(10-nu); j++) Instantiate (CubePrefab1, new Vector3 (j*2,4,0), Quaternion.identity); Debug.Log(number1+number2); } // Update is called once per frame void Update () { }
}
###試したこと
このスクリプトで出現した箱の数をプレイヤーがキーボードで答えを打ち込ませたいのですが、
InputFieldのようなシーン上に枠が出てくるものは使いたくないので、キーボードから打ち込んだ数字をパソコン内で判断できるようなものはないでしょうか。
###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/09/10 03:04
2017/09/10 03:49
2017/09/11 01:13
2017/09/11 01:48
2017/09/11 01:58
2017/09/11 06:09