2014-09-13 65 views
-2

我已經在MonoDevelop中輸入此代碼,並將其拖動到主相機。插入按鈕,腳本與統一的c#腳本不出現

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!"); 
    } 
} 

但是按鈕仍然沒有出現。我錯過了什麼?

+0

可能的重複[如何將控件放在屏幕上?](http://stackoverflow.com/questions/34699761/how-do-i-put-controls-on-screen) – Fattie 2016-02-03 19:19:01

回答

0

方法名稱區分大小寫,在此情況下,需要爲OnGUI而不是onGUI(按照the docs)。

+0

好的,謝謝:) – user3150599 2014-09-14 07:23:30