彬哥和你一起学习U3D开发(3)--按钮控件使用

彬哥和你一起学习U3D开发(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. }

复制代码

二、按钮控件创建

<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>

六、 源码
[#### 本帖隐藏的内容

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

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容