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. Unity 利用NGUI做屏幕分辨率适配+学习UIDraggablePanel的使用

    原地址:http://blog.sina.com.cn/s/blog_697b1b8c0101g2r4.html 大家使用unity,一定有看中其跨平台的强大功能,因此也难免会遇到不同屏幕分辨率适配的 ...

  2. The CompilerVersion constant identifies the internal version number of the Delphi compiler.

    http://delphi.wikia.com/wiki/CompilerVersion_Constant The CompilerVersion constant identifies the in ...

  3. Shortcut key for CodeBlocks

    一.not only in CodeBlocks 13.12 Undo last action Ctrl + Z //后退 Redo last action Ctrl + Shift + Z //前进 ...

  4. 【云计算】Dockerfile示例模板

    Dockerfile FROM debian:jessie MAINTAINER "Konrad Kleine" USER root ####################### ...

  5. Intersection of Two Arrays | & ||

    Intersection of Two Arrays Given two arrays, write a function to compute their intersection. Example ...

  6. js 基本介绍

    ecma  对象 三个包类型  String   ParseInt  ParseDouble instanceof typeof Math  对象 Array Date RegExp -- bom对象 ...

  7. mysql 恢复备份

    1.在my.cnf 文件中增加以下配置 log-bin=/var/lib/mysql/mysql-binloglog-bin-index = /var/lib/mysql/mysql-binlog 2 ...

  8. VS2013+opencv2.4.9(10)配置

    1. 下载opencv2.4.9,然后解压到一个位置 设置opencv SDK解压目录,点击Extract后解压   我是习惯于解压到这个位置的.   解压过程如上图.  2. 文件目录介绍  解压后 ...

  9. linux安装gcc

    方法:输入命令: :(1) :yum -y install gcc (2) yum -y install gcc-c++(3)yum install make 我的再输入  yum -y instal ...

  10. Android之Tab类总结

    本文主要包括以下Tab类实现方式 FragmentTabHost+Fragment实现 传统的ViewPager实现 FragmentManager+Fragment实现 ViewPager+Frag ...