Any idea what this error message means?

I’m getting this error when I run my application in the editor:

ArgumentOutOfRangeException: < 0 || >= this.Length
Parameter name: startIndex



System.String.LastIndexOf (Char value, Int32 startIndex, Int32 count) 
System.String.LastIndexOf (Char value, Int32 startIndex) 
UnityEngine.TextEditor.SelectToPosition (Vector2 cursorPosition) 
UnityEditor.EditorGUI.DoTextField (UnityEditor.RecycledTextEditor editor, Int32 id, Rect position, System.String text, UnityEngine.GUIStyle style, System.String allowedletters, System.Boolean changed, Boolean reset, Boolean multiline, Boolean passwordField)   (at /Users/build/builds/unity-branches-2.5.x/unity-2.5.x/Editor/Mono/Generated/EditorGUI.cs:321)
UnityEditor.EditorGUI.DoFloatField (UnityEditor.RecycledTextEditor editor, Rect position, Rect dragHotZone, Int32 id, Single value, System.String formatString, UnityEngine.GUIStyle style, Boolean draggable)   (at /Users/build/builds/unity-branches-2.5.x/unity-2.5.x/Editor/Mono/Generated/EditorGUI.cs:842)
UnityEditor.EditorGUI.FloatField (Rect position, UnityEngine.GUIContent label, Single value, UnityEngine.GUIStyle style)   (at /Users/build/builds/unity-branches-2.5.x/unity-2.5.x/Editor/Mono/Generated/EditorGUI.cs:734)
UnityEditor.EditorGUI.FloatField (Rect position, UnityEngine.GUIContent label, Single value)   (at /Users/build/builds/unity-branches-2.5.x/unity-2.5.x/Editor/Mono/Generated/EditorGUI.cs:728)
UnityEditor.EditorGUI.PropertyField (Rect position, UnityEditor.SerializedProperty property, Boolean isInstantiatedPrefab)   (at /Users/build/builds/unity-branches-2.5.x/unity-2.5.x/Editor/Mono/Generated/EditorGUI.cs:2151)
UnityEditor.GenericInspector.OnOptimizedInspectorGUI (Rect contentRect)   (at /Users/build/builds/unity-branches-2.5.x/unity-2.5.x/Editor/Mono/Inspector/GenericInspector.cs:128)
UnityEditor.InspectorWindow.OnGUI ()   (at /Users/build/builds/unity-branches-2.5.x/unity-2.5.x/Editor/Mono/Inspector/InspectorWindow.cs:318)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000]

Are you using editor scripts? It looks like something’s going wrong in some editor script, and as you’re saying that this is happening when you run the application, it would be in some editor script that has special handling when in play-mode (otherwise this should occur during normal editor operation, too).

It could, however, also be that the problem is a result of some funky change the game makes which then breaks something in the editor. It might be a Unity bug.

To be a bit more exact: It seems to be something in the inspector, in one of the float-fields.

Does it disappear when you select another GO before starting the application? If so, that would be an indication that this specific GO is doing the “weird stuff”.

It also may have to do something with selection in the field that’s causing the exception. If you are certain that this has nothing to do with a customer editor script, I’d file a bug report (if you find a way of reliably reproducing this … might be you find a workaround for your specific case on the way).

Nope, I’m not running any editor scripts and I’m not even sure when it appeared so I could try to recreate it. To be honest, I’ve been finding 2.5.1 to be kinda flaky. I run into weird error messages like this just about daily, that I don’t seem to be able to reproduce, and if I run the same project in 2.1, they don’t appear at all. I at one point was having a huge performance issue with 2.5.1 (I was getting 1/2 the frame rate of the same project in 2.1) and UT wasn’t able to reproduce it. I managed to fix that, but how I fixed it is a bit of a mystery. I’ve given up on posting bug reports. Most of these errors only appear once, or appear so infrequently I have a hard time identifying the cause.