I am trying to style some input text so the user can change colors, font, etc. I have ‘textStyle’ set to the users current font settings, but I want the input to show these settings (ie. if they choose green text, show green text as they type in the input).
This works, when I don’t set the style of the input
GUI.SetNextControlName ("MessageInput");
newMessage = GUI.TextField(new Rect(10, curHeight - sendHeight - 15, curWidth - sendWidth - 25, sendHeight), newMessage, 300);
GUI.skin = oldSkin;
if (GUI.Button(new Rect(curWidth - sendWidth - 10, curHeight - sendHeight - 15, sendWidth, sendHeight), "Send") || (Event.current.type == EventType.keyDown && Event.current.character == '
'))
{
print(newMessage);
GetComponent().sendChatMessage(newMessage);
newMessage = “”;
}
But, when I set my Input to a style, the Enter key no longer works… can someone explain to me why this is?
Example :
newMessage = GUI.TextField(new Rect(10, curHeight - sendHeight - 15, curWidth - sendWidth - 25, sendHeight), newMessage, 300, textStyle);
That changes the color, but the enter key no longer works to send the message.