※ 引述《kingworld (珊夜 薰)》之銘言:
: 自己覺得程式碼應該沒有問題
: (好像程式有問題的人都會這樣說)
: 是希望在同一個場景裡面
: 按下一個按鈕之後 它的圖片/背景會換成另外一張圖
: 是用javascript寫的
: 以下是程式碼
你這段程式碼的邏輯是
: -----------------------------------------------------------------
: var aTexture : Texture2D;
: function OnGUI() {
: if(GUI.Button(Rect(0,0,100,20),"AAA")){
如果按下按鈕
: GUI.DrawTexture(Rect(0,0,Screen.width,Screen.height), aTexture, ScaleMode.StretchToFill, true,0);
: print("AAA");
畫一張圖, 接著 print("AAA")
: }
: }
所以只畫了一次
應該改成類似
var draw : boolean
function OnGUI ()
{
if (draw)
GUI.DrawTexture(....)
if (GUI.Button(...))
draw = ! draw;
}
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 118.167.193.244