GUI.TextField

 
public static function TextField(position: Rect, text: string): string;
public static string TextField(Rect position, string text);
public static function TextField(position: Rect, text: string, maxLength: int): string;
public static string TextField(Rect position, string text, int maxLength);
public static function TextField(position: Rect, text: string, style: GUIStyle): string;
public static string TextField(Rect position, string text, GUIStyle style);
public static function TextField(position: Rect, text: string, maxLength: int, style: GUIStyle): string;
public static string TextField(Rect position, string text, int maxLength, GUIStyle style);

Parameters

position Rectangle on the screen to use for the text field.
text Text to edit. The return value of this function should be assigned back to the string as shown in the example.
maxLength The maximum length of the string. If left out, the user can type for ever and ever.
style The style to use. If left out, the textField style from the current GUISkin is used.

Returns

string The edited string.

Description

Make a single-line text field where the user can edit a string.

  1. var stringToEdit : String = "Hello World";
  2.  
  3. function OnGUI () {
  4. // Make a text field that modifies stringToEdit.
  5. stringToEdit = GUI.TextField (Rect (10, 10, 200, 20), stringToEdit, 25);
  6. }
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class ExampleClass : MonoBehaviour {
  5. public string stringToEdit = "Hello World";
  6. void OnGUI() {
  7. stringToEdit = GUI.TextField(new Rect(10, 10, 200, 20), stringToEdit, 25);
  8. }
  9. }

GUI TextField的更多相关文章

  1. Unity GUI TextField不能输入文字

    最近在弄Unity的GUI. 也算是好久不用了,有点不熟悉了. 用TextField的时候发现GUI是出来了不过不能输入文字 到网上查了一下说要用一个public的string来接收 我看了我的代码 ...

  2. Unity3D入门之GUI基础以及常用GUI控件使用(2)

    1.GUI基础 (1)GUI部分是每帧擦除重绘的,只应该在OnGUI中绘制GUI,按钮:GUILayout.Button(“Hello”); 只读标签:GUILayout.Label() (2)修改控 ...

  3. Unity3D GUI学习

    Unity3D内置有GUI, 首先,使用GUI实现一个按钮,并且点击实现触发, void OnGUI() { //GUI.Button (new Rect (10,10,50,50), "n ...

  4. 从零开始学习UNITY3D(GUI篇)

    邻近年底,心也有些散乱,加上工作忙了一阵,在达内培训的课程也落下了不少.对unity3d的热度似乎也有点点下降.痛定思痛,又在淘宝上买了写蛮牛网的视频.总之不管是用任何手段都要逼着自己不要浪费了培训的 ...

  5. Unity3D学习笔记(一)GUI控件的调用

    GUI控件:1.在Start中初始化,在OnGUI中调整.2.公有变量才会出现在Inspector面板.3.GUI控件的初始化和处理在OnGUI内完成.4.JavaScript的中文为UTF-8编码可 ...

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

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

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

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

  8. Unity-------------------------关于GUI绘制的编程

    转载:在这篇文章中我将给读者介绍Unity中的图形用户界面(GUI)编程.Unity有一个非常强大的GUI脚本API.它允许你使用脚本快速创建简单的菜单和GUI. 简介 Unity提供了使用脚本创建G ...

  9. unity3d之GUI

    1.Button void OnGUI() { , , , ), "up")) {flg=true; } , , , ), "down")) {flg=fals ...

随机推荐

  1. Windows8.1 与Ubuntu14.04双系统

    机型:联想 Y480 现有操作系统:win8.1 64位 物理内存:8G 磁盘存储:两个硬盘 1. SSD为固态盘 Solid State Drives  110G   现已安装有win8系统 2.H ...

  2. Python获取秒级时间戳与毫秒级时间戳

    获取秒级时间戳与毫秒级时间戳 import time import datetime t = time.time() print (t) #原始时间数据 print (int(t)) #秒级时间戳 p ...

  3. Nodejs进阶:使用DiffieHellman密钥交换算法

    ## 简介 Diffie-Hellman(简称DH)是密钥交换算法之一,它的作用是保证通信双方在非安全的信道中安全地交换密钥.目前DH最重要的应用场景之一,就是在HTTPS的握手阶段,客户端.服务端利 ...

  4. 关于tomcat的Unsupported major.minor version 51.0问题记录

    今天在构建一个应用时使用了注解的方式,可能是别的原因,正常访问一个servlet的时候报了一个从来没见过的错误. 2017-5-12 15:54:52 org.apache.catalina.core ...

  5. Java温故而知新-冒泡法排序

    冒泡法排序是各种初学者在学习数组与循环结构时都会练习的一种简单排序算法. 冒泡法的精髓在于比较相邻的两个元素,较大的元素会不断的排到队伍后面去,就像水里的泡泡一样不断向上跑. 想像一下倒在一个透明玻璃 ...

  6. 阿里 java学习之路

    https://maimai.cn/article/detail?fid=96107193&push_id=5603&share_user=http%3A%2F%2Fi9.taou.c ...

  7. 自己动手写fullPage插件

    仿造fullPage.js https://alvarotrigo.com/fullPage/#firstPage 自己参照网上教程写了一个,加了注释.主要是练习造轮子的能力,需求是不断变化的只拿来用 ...

  8. 移动端车牌识别ocr系统

    移动端车牌识别ocr系统优点: 1.识别速度快:高度优化的车牌定位和识别算法,识别时间≤50毫秒(200万图片). 2.识别率:白天识别率≥99.7%:夜间识别率≥98%. 3.识别速度:单张图片识别 ...

  9. 【小白成长撸】--链栈(C语言版)

    // 链栈.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <stdio.h> #include <st ...

  10. hdu 3342 拓扑排序 水

    好久没切题  先上水题! 拓扑排序! 代码: #include<iostream> #include<cstdio> #include<cstring> using ...