Input text Line Limit

Hello,

I’m trying to create a text editable paper in my game to let the player take some notes.
but when i use an UI Input field i can’t set the line number limit and all the top lines are hidden when there is to many characters.
There is a solution to limit the number of lines in an Input text ?

http://docs.unity3d.com/ScriptReference/UI.InputField-characterLimit.html ?

The problem with “CaracterLimit” it’s you can’t limit the number of lines on an Input field in “Multi line” mode.

I also have this problem, character limit doesn’t limit the amount of lines. If there was a way to get the amount of lines in a text object, including both the lines from horizontal overflow and newlines, I could get a workaround. But I don’t know how to do that.

This was my workaround. I called this code every time the input field was edited. It calculates the amount of lines in the input field, and removes the last character if it surpasses the limits. This ONLY works with monospaced/fixed-width fonts! Hope this helps.

        int pageCharWidth = 13;
        int pageMaxLines = 9;

        string text = inputField.text;
        string[] lines = text.Split('\n');
        int numberOfLines = lines.Length;
        foreach (string line in lines)
        {
            numberOfLines += line.Length / (pageCharWidth+1);
        }
//remove last letter if it surpasses limit
        if (numberOfLines > pageMaxLines)
        {
            inputField.text = text.Substring(0, text.Length - 1);
        }