ArgumentOutOfRangeException: startIndex + length > this.length
Parameter name: length
System.String.Substring (Int32 startIndex, Int32 length) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/String.cs:356)
UIInput.GetLeftText () (at Assets/NGUI/Scripts/UI/UIInput.cs:987)
UIInput.Insert (System.String text) (at Assets/NGUI/Scripts/UI/UIInput.cs:940)
UIInput.Update () (at Assets/NGUI/Scripts/UI/UIInput.cs:640)
ArgumentOutOfRangeException: startIndex + length > this.length
Parameter name: length
System.String.Substring (Int32 startIndex, Int32 length) (at /Users/builduser/buildslave/monoAndRuntimeClassLibs/build/mcs/class/corlib/System/String.cs:356)
UIInput.GetSelection () (at Assets/NGUI/Scripts/UI/UIInput.cs:1018)
UIInput.ProcessEvent (UnityEngine.Event ev) (at Assets/NGUI/Scripts/UI/UIInput.cs:877)
UIInput.OnGUI () (at Assets/NGUI/Scripts/UI/UIInput.cs:675)
the bug occur like this:
input two chars like "12",
and input two space so like "12 ",
and use mouse select the value,
the error will occur!
and i notice that:
when you use mouse in a empty uiinput drag..
there will be a space " " in the input field...
and i just change the code like this:
protected string GetLeftText ()
{
int min = Mathf.Min(mSelectionStart, mSelectionEnd);
return (string.IsNullOrEmpty(mValue) || min < 0) ? "" : mValue.Substring(0, Mathf.Min(min, mValue.Length));
}
protected string GetSelection ()
{
if (string.IsNullOrEmpty(mValue) || mSelectionStart == mSelectionEnd)
{
return "";
}
else
{
int min = Mathf.Min(mSelectionStart, mSelectionEnd);
int max = Mathf.Max(mSelectionStart, mSelectionEnd);
return mValue.Substring(min, Mathf.Min(max - min, mValue.Length));
}
}