彬哥和你一起學(xué)習(xí)U3D開發(fā)(3)--按鈕控件使用

彬哥和你一起學(xué)習(xí)U3D開發(fā)(3)--按鈕控件使用


一、 C#腳本 代碼如下:

  1. using System.Collections;

  2. using System.Collections.Generic;

  3. using UnityEngine;

  4. public class binge : MonoBehaviour {

  5. // Use this for initialization

  6. void Start () {

  7. }

  8. // Update is called once per frame

  9. void Update () {

  10. }

  11. public void Click_test()

  12. {

  13. Debug.Log("點擊測試");

  14. }

  15. }

復(fù)制代碼

二夜焦、按鈕控件創(chuàng)建

<ignore_js_op style="overflow-wrap: break-word; color: rgb(68, 68, 68); font-family: "microsoft yahei"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">
image

</ignore_js_op>

三废登、腳本掛接到空間上

<ignore_js_op style="overflow-wrap: break-word; color: rgb(68, 68, 68); font-family: "microsoft yahei"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">
image

</ignore_js_op>

四、 腳本綁定事件

<ignore_js_op style="overflow-wrap: break-word; color: rgb(68, 68, 68); font-family: "microsoft yahei"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">
image

</ignore_js_op>

五铝条、 點擊測試

<ignore_js_op style="overflow-wrap: break-word; color: rgb(68, 68, 68); font-family: "microsoft yahei"; font-size: 14px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial;">
image

</ignore_js_op>

六、 源碼
[#### 本帖隱藏的內(nèi)容

https://github.com/Golangltd/codeclass](https://github.com/Golangltd/codeclass)

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市墙杯,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌括荡,老刑警劉巖高镐,帶你破解...
    沈念sama閱讀 219,110評論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場離奇詭異畸冲,居然都是意外死亡嫉髓,警方通過查閱死者的電腦和手機,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,443評論 3 395
  • 文/潘曉璐 我一進店門邑闲,熙熙樓的掌柜王于貴愁眉苦臉地迎上來岩喷,“玉大人,你說我怎么就攤上這事监憎∩匆猓” “怎么了?”我有些...
    開封第一講書人閱讀 165,474評論 0 356
  • 文/不壞的土叔 我叫張陵鲸阔,是天一觀的道長偷霉。 經(jīng)常有香客問我迄委,道長,這世上最難降的妖魔是什么类少? 我笑而不...
    開封第一講書人閱讀 58,881評論 1 295
  • 正文 為了忘掉前任叙身,我火速辦了婚禮,結(jié)果婚禮上硫狞,老公的妹妹穿的比我還像新娘信轿。我一直安慰自己,他們只是感情好残吩,可當(dāng)我...
    茶點故事閱讀 67,902評論 6 392
  • 文/花漫 我一把揭開白布财忽。 她就那樣靜靜地躺著,像睡著了一般泣侮。 火紅的嫁衣襯著肌膚如雪即彪。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,698評論 1 305
  • 那天活尊,我揣著相機與錄音隶校,去河邊找鬼。 笑死蛹锰,一個胖子當(dāng)著我的面吹牛深胳,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播铜犬,決...
    沈念sama閱讀 40,418評論 3 419
  • 文/蒼蘭香墨 我猛地睜開眼舞终,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了翎苫?” 一聲冷哼從身側(cè)響起权埠,我...
    開封第一講書人閱讀 39,332評論 0 276
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎煎谍,沒想到半個月后攘蔽,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 45,796評論 1 316
  • 正文 獨居荒郊野嶺守林人離奇死亡呐粘,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點故事閱讀 37,968評論 3 337
  • 正文 我和宋清朗相戀三年满俗,在試婚紗的時候發(fā)現(xiàn)自己被綠了。 大學(xué)時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片作岖。...
    茶點故事閱讀 40,110評論 1 351
  • 序言:一個原本活蹦亂跳的男人離奇死亡唆垃,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出痘儡,到底是詐尸還是另有隱情辕万,我是刑警寧澤,帶...
    沈念sama閱讀 35,792評論 5 346
  • 正文 年R本政府宣布,位于F島的核電站渐尿,受9級特大地震影響醉途,放射性物質(zhì)發(fā)生泄漏。R本人自食惡果不足惜砖茸,卻給世界環(huán)境...
    茶點故事閱讀 41,455評論 3 331
  • 文/蒙蒙 一隘擎、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧凉夯,春花似錦货葬、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,003評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至再沧,卻和暖如春尼夺,著一層夾襖步出監(jiān)牢的瞬間尊残,已是汗流浹背炒瘸。 一陣腳步聲響...
    開封第一講書人閱讀 33,130評論 1 272
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留寝衫,地道東北人顷扩。 一個月前我還...
    沈念sama閱讀 48,348評論 3 373
  • 正文 我出身青樓,卻偏偏與公主長得像慰毅,于是被迫代替她去往敵國和親隘截。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點故事閱讀 45,047評論 2 355

推薦閱讀更多精彩內(nèi)容