- Home /
Question by
ess · May 27, 2012 at 01:14 AM ·
javascriptcountercharacterstextarea
Character Counter using GUILayout.Label
Hello all,
I'm trying to tack a simple character counter onto a GUILayout.TextArea with a 500 character limit.
Relevant bit:
var editTitleStringRect = Rect (0,0,10,10);
function OnGUI {
GUILayout.Label("\nAuthor's Notes");
editDescriptionString = GUILayout.TextArea (editDescriptionString, 500);
}
I'm not too picky about whether it outputs the number of characters typed or number of characters remaining. If anyone has any guidance it would be greatly appreciated, as I'm at a loss.
Thanks!
All the Best, Ess.
Comment
Best Answer
Answer by whydoidoit · May 27, 2012 at 01:17 AM
Try this:
GUILayout.Label((500 - editDescriptionString.Length).ToString());
Your answer