- Home /
Single line GUI.TextField with GUISkin custom style problem
When i try to make single line GUI.TextField with custom style ,it become multiple line Text Field.
using UnityEngine;
using System.Collections;
public class Example : MonoBehaviour
{
public GUISkin MyGUISkin;
public string stringToEdit = "Hello ";
void OnGUI()
{
stringToEdit = GUI.TextField (new Rect(Screen.width*0.3f,Screen.height*0.3f,Screen.width *0.3f,Screen.height * 0.03f) ,stringToEdit,25,MyGUISkin.customStyles[22])
}
}
If i remove GUISkin.customStyles from code it will work as single line , with default style
How can i add single line GUI.TextField with custom style
Try checking what the the lineHeight and wordWrap variables for your custom style #22 (just add a Debug.Log for both values). Compare that to the default style. I'd say it's something in those settings.
Answer by LijuDeveloper · Nov 06, 2013 at 05:47 AM
I got solution .
GUI.TextField is replaced with GUI.TextArea .
Then addjusted padding
Word Wrap check box is selected
Text clipping set as 1
Your answer
Follow this Question
Related Questions
GUI.TextField 1 Answer
Accents work on windows but not in mac 1 Answer
Making the words print in the middle of the Gui.TextField? 1 Answer
How do i automatically select a Text.Field? 1 Answer
text fields and GUI 1 Answer