Skip to content

Instantly share code, notes, and snippets.

@nabesi777
Created September 19, 2018 21:55
Show Gist options
  • Save nabesi777/9c632bbc63c5e163ffe094fe2c911ba1 to your computer and use it in GitHub Desktop.
Save nabesi777/9c632bbc63c5e163ffe094fe2c911ba1 to your computer and use it in GitHub Desktop.
TextField Unity C#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TextGUI : MonoBehaviour {
private string textFieldString = "text field";
private string textAreaString = "text area";
void OnGUI()
{     //左からTextFieldの位置・サイズ・最初から表示させる文字列 文字数リミット(25文字)
textFieldString = GUI.TextField(new Rect(400, 15, 100, 30), textFieldString, 25);
//左からTextAreaの位置・サイズ・最初から表示させる文字列 文字数リミット(250文字)
textAreaString = GUI.TextArea(new Rect(510, 15, 100, 100), textAreaString, 250);
//TextFieldに記入された文字列の表示位置・サイズ・最初から表示させる文字列
GUI.Label(new Rect(410, 45, 100, 100), textFieldString);
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment