Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
User interface Unity3D gui表单文本太小_User Interface_Unity3d_Textfield_Unityscript - Fatal编程技术网

User interface Unity3D gui表单文本太小

User interface Unity3D gui表单文本太小,user-interface,unity3d,textfield,unityscript,User Interface,Unity3d,Textfield,Unityscript,因此,对于我的代码,我让用户在提交分数之前输入他们的名字。但是,表单文本非常小。“名称”和“提交”不会更改。我可以在用户输入姓名的文本字段中更改文本 谢谢你的见解 private var formNick = ""; var pointObject : Transform; private var formScore = ""; var bigFont: GUIStyle; var formText = ""; var URL = " "; function OnGUI() { GU

因此,对于我的代码,我让用户在提交分数之前输入他们的名字。但是,表单文本非常小。“名称”和“提交”不会更改。我可以在用户输入姓名的文本字段中更改文本

谢谢你的见解

private var formNick = ""; 
var pointObject : Transform;
private var formScore = "";
var bigFont: GUIStyle;

var formText = ""; 
var URL = " ";


function OnGUI() {

GUI.Label( Rect ( Screen.width/2 - 20, Screen.height/2, 80, 20), "Name:" ); 
formNick = GUI.TextField ( Rect (Screen.width/2 - 50, Screen.height/2 + 30, 100, 20), formNick,50, bigFont ); //here you will insert the new value to variable formNick

if ( GUI.Button ( Rect (Screen.width/2 - 50, Screen.height/2 + 50, 100, 20) , "Submit Score" ) ){ //just a button
    if(formNick != "")
    {
        Submit();
        enabled = false;
        //Testing

    }
    else
    {
        Debug.Log("Please enter a name");
    }
}


}
function Submit()
{
var form = new WWWForm(); 
formScore = pointObject.GetComponent(pointManager).points.ToString();
form.AddField( "name", formNick );
form.AddField( "score", formScore );

var w = WWW(URL, form);

yield w;

if (w.error != null ) {
    print(w.error); 
} else {
    print("Score Submitted" + formScore);
}
formNick = ""; 
formScore = "";

  Application.LoadLevel("scoreboard");

}

您可以使用GUI样式更改字体大小

function OnGUI() {
    var style : GUIStyle = new GUIStyle();
    style.fontSize = 25;
    GUI.Label( Rect ( Screen.width/2 - 20, Screen.height/2, 80, 20), "Name:", style); 
}