首页 > 编程语言 > 详细

unity3d常用控件

时间:2017-06-05 20:41:25      阅读:431      评论:0      收藏:0      [点我收藏+]

直接上代码,就能看懂了。

private string txt1;
private string pwd1;
private int tool1;
private bool isMuted;
private string msgBody;

// Use this for initialization
void Start () {
    txt1 = "";
    pwd1 = "";
    tool1 = 0;
    isMuted = true;
    msgBody = "";
}
//GUI内容显示
void OnGUI(){
    //文本框
    txt1=GUILayout.TextField (txt1,GUILayout.Width(100));
    //密码框,用*来代替原字符
    pwd1 = GUILayout.PasswordField (pwd1, *, GUILayout.Width (100));
    //按钮,如果按下会返回true
    if (GUILayout.Button ("showLog")) {
        Debug.Log (1);
    }
    //Tab页,tool1用于接收按下的是哪一个tab,默认从0开始
    tool1 = GUILayout.Toolbar (tool1, new string[]{ "a", "b", "c" });
    Debug.Log (tool1);
    //复选框,可以选中或不选中
    if(GUILayout.Toggle(isMuted,"静音")){
        isMuted = false;
    }else{
        isMuted = true;
    }
    //多行文本
    msgBody=GUILayout.TextArea(msgBody,GUILayout.Width(100),GUILayout.Height(50));
}

 

unity3d常用控件

原文:http://www.cnblogs.com/chenyangsocool/p/6946914.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!