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 {

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.


All the Best,

Try this:

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