using UnityEngine;
using System.Collections; public class Gui : MonoBehaviour { public Texture2D buttonTexture; private string str; private int frameTime; // Use this for initialization
void Start () {
str="请您点击按钮";
} // Update is called once per frame
void Update () { } void OnGUI()
{
GUI.Label (new Rect (, , Screen.width, ), str); if (GUI.Button (new Rect (, , buttonTexture.width, buttonTexture.height), buttonTexture)) { str="您点击了图片按钮";
}
GUI.color = Color.green;
GUI.backgroundColor = Color.red;
if (GUI.Button (new Rect (, , , ), "文字按钮")) { str="您点击了文字按钮";
} GUI.color = Color.yellow;
GUI.backgroundColor = Color.black; if (GUI.RepeatButton (new Rect (, , , ), "按钮按下中")) { str=frameTime+"";
frameTime++;
} }
}

游戏 gui button的更多相关文章

  1. 【Visual C++】游戏开发五十六 浅墨DirectX教程二十三 打造游戏GUI界面(一)

    本系列文章由zhmxy555(毛星云)编写,转载请注明出处. 文章链接:http://blog.csdn.net/poem_qianmo/article/details/16384009 作者:毛星云 ...

  2. unity, GUI.Button texture is black

    GUI.Button(rect,tex),结果显示出来tex是黑的,原来是因为我以前在别处调用了GUI.contentColor =Color.black. 参考:http://answers.uni ...

  3. EZ GUI Button和Checkbox创建

    第一次接触EZ GUI,记录学习过程 准备工作 导入资源 导入 EZ GUI 1.0795.unitypackage 和 SpriteManager2 v1.92.unitypackage EZGUI ...

  4. Unity3D笔记八 Unity生命周期及动画学习

    Unity脚本从唤醒到销毁有着一套比较完善的生命周期,添加任何脚本都必须遵守自身生命周期法则.下面介绍一下生命周期中由系统自身调用的几个比较重要的方法.  Update(){}.正常更新,用于更新逻 ...

  5. 从一点儿不会开始——Unity3D游戏开发学习(二) ——GUI控件之Button

    一些废话 我在上一篇“一点儿不会”的系列随笔中说大概一周会发个2~3篇关于Unity的学习笔记.可这就两周过去了,我还停留在一篇的进度上,主要是这两周发生了一些事情导致我更新缓慢.其实截至目前为止,上 ...

  6. unity 翻牌游戏(全都是gui)

    ;//列数 ;//行数 ;//所有卡片的数量 var matchesNeededToWin:int = totalCards*0.5;//最大匹配数,用来判断游戏是否胜利 ; ; ; var aCar ...

  7. 2.GUI控件的使用 --《UNITY 3D 游戏开发》笔记

    1.Label 控件 编写脚本文件,直接绑定在main camera上 public class labelScript : MonoBehaviour { //设定一个值来接收外部赋值的字符串 pu ...

  8. 3.GUI Skin和自定义风格的组件 --《UNITY 3D 游戏开发》笔记

    自定义皮肤还是很受女孩子欢迎的吧,这样操作一下界面是不是就可以变得美美哒了~ 先pick一下测试代码: public class GUISkinScript : MonoBehaviour { //自 ...

  9. unity3d的GUI元素的界面坐标系统总结(有公式)

    GUIText 和GUITexture 1.GUIText 锚点(Anchor)的概念我就不介绍了.像NGUI和tookit2d还有 Cocos2d中都有这个重要的概念,对于图片我们可以认为是图片自身 ...

随机推荐

  1. 百度图片爬虫-python版

               self.browser=imitate_browser.BrowserBase()            self.chance=0            self.chanc ...

  2. 将mysql的查询结果导出为csv

    要将mysql的查询结果导出为csv,一般会使用php连接mysql执行查询,将返回的查询结果使用php生成csv格式再导出. 但这样比较麻烦,需要服务器安装php才可以实现. 直接使用mysql导出 ...

  3. The server does not support version 3.0 of the J2EE Web module specification

    1.错误: 在eclipse中使用run->run on server的时候,选择tomcat6会报错误:The server does not support version 3.0 of t ...

  4. Python Django 的 django templatedoesnotexist

    django 1.8版本的解决方案 在  setting.py 这个文件里 TEMPLATES = [ ...... #原来的 #'DIRS': [ ], //  这个 列表里添加 template路 ...

  5. 编译 uImage

    编译 uImage 和测试 u-Boot - 小猪爱拱地 - 博客频道 - CSDN.NET http://blog.csdn.net/caspiansea/article/details/38057 ...

  6. Android Your content must have a ListView whose id attribute is 'android.R.id.list'错误的解决办法

    在Android开发中,ListView有着很重要的地位,使用的场合也非常的多 错误提示:Your content must have a ListView whose id attribute is ...

  7. Java for LeetCode 025 Reverse Nodes in k-Group

    Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If ...

  8. 【回溯】图的m着色问题

    问题 C: [回溯]图的m着色问题 时间限制: 1 Sec  内存限制: 128 MB提交: 1  解决: 1[提交][状态][讨论版] 题目描述 给定无向连通图G=(V, E)和m种不同的颜色,用这 ...

  9. ShortestPath:Silver Cow Party(POJ 3268)

    牛的聚会 题目大意:一群牛在一块农田的不同的点,现在他们都要去到同一个地方开会,然后现在从那个地方回到原来的位置,点与点之间的连线都是单向的,并且通过一个路径需要一定时间,问你现在哪只牛需要最多的时间 ...

  10. java获取tomcat路径

    获取tomcat路径 String savePath3 = System.getProperty("catalina.home"); E:\apache-tomcat-7.0.63 ...