【发布时间】:2014-08-07 19:22:27
【问题描述】:
谁能告诉我为什么我的库存箱没有出现?如果用户按下库存按钮,我希望显示库存框。我没有收到任何错误,如果我将清单框放在 if 语句之外,它可以正常工作。
using UnityEngine;
using System.Collections;
public class MyGUI : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
void OnGUI () {
// Make a background for the button
GUI.Box (new Rect (10, 10, 100, 200), "Menu");
// Make a button.
// Be able to click that button.
// If they click it return inventory screen.
if (GUI.Button (new Rect(20, 50, 75, 20), "Inventory")) {
Debug.Log("Your inventory opens");
GUI.Box (new Rect (150, 10, 300, 200), "Inventory");
}
}
}
【问题讨论】:
标签: c# user-interface unity3d