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("

Author’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.

Try this:

GUILayout.Label((500 - editDescriptionString.Length).ToString());