【问题标题】:insert button, scripting with c# in unity not appear插入按钮,统一用c#编写脚本不会出现
【发布时间】:2014-11-07 07:06:10
【问题描述】:

我已经在 MonoDevelop 中输入此代码,并将其拖到主摄像头。

using UnityEngine;
using System.Collections;

public class test : MonoBehaviour {

    void onGUI() {
        GUI.Button(new Rect(Screen.width * 0.5f, Screen.height * 0.5f, 200, 50), "Click ME!");
    }
}

但按钮仍然没有出现。我错过了什么?

【问题讨论】:

标签: c# button user-interface unity3d monodevelop


【解决方案1】:

方法名称区分大小写,在这种情况下,需要为OnGUI 而不是onGUI(根据the docs)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-09-25
    • 1970-01-01
    • 1970-01-01
    • 2014-06-12
    • 1970-01-01
    • 2010-11-07
    • 1970-01-01
    相关资源
    最近更新 更多