これまでのところ、次のスクリプトがあります。
Using UnityEngine;
using System.Collections;
public class text : MonoBehaviour {
public GameObject mainCam;
public bool showButton = false;
void OnGUI () {
// Make a background box
GUI.Box(new Rect(10,10,230,150), "Menu");
if (GameObject.Find("block1") && Input.GetMouseButtonDown(0)) {
showButton = true;
if(GUI.Button (new Rect (30,40,200,70), "Back to the blocks ")) {
print ("You clicked the button! The menu now appears");
mainCam.transform.position= new Vector3(-.13f, 0.87f, -8);
Camera.main.orthographicSize = 0.4f;
}
}
}
}
ビューが複数のブロック上にあるときにボタンを無効または非アクティブにしたいのですが、1 つのブロックをクリックすると、ブロックの 1 つのズームイン ビューに移動し、gui.button が表示されます。次に、すべてのブロックが表示された状態でメイン ビューに戻ると、ボタンが再び無効になります。どうすればいいのかわかりません。