yasirkula / UnityIngameDebugConsole

A uGUI based console to see debug messages and execute commands during gameplay in Unity
MIT License
2.05k stars 217 forks source link

When you press tab for fill up suggestion. In some cases there is an exception #63

Closed cholushkin closed 2 years ago

cholushkin commented 2 years ago

Description of the bug

A clear and concise description of what the bug is. Before reporting a bug, please do a quick search in Issues to see if it is already reported. If the documentation has a FAQ (Frequently Asked Questions), please also check out the entries there.

Reproduction steps

Start to enter text , for example "w" or "u" then pres "tab". Not always but some times you will have exception

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index System.Collections.Generic.List1[T].get_Item (System.Int32 index) (at <00c558282d074245ab3496e2d108079b>:0) IngameDebugConsole.DebugLogConsole.GetAutoCompleteCommand (System.String commandStart) (at Assets/Libs/IngameConsole/Scripts/DebugLogConsole.cs:599) IngameDebugConsole.DebugLogManager.OnValidateCommand (System.String text, System.Int32 charIndex, System.Char addedChar) (at Assets/Libs/IngameConsole/Scripts/DebugLogManager.cs:852) UnityEngine.UI.InputField.Append (System.Char input) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/InputField.cs:2399) UnityEngine.UI.InputField.KeyPressed (UnityEngine.Event evt) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/InputField.cs:1922) UnityEngine.UI.InputField.OnUpdateSelected (UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/UI/Core/InputField.cs:1976) UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IUpdateSelectedHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:106) UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction1[T1] functor) (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/ExecuteEvents.cs:272) UnityEngine.EventSystems.EventSystem:Update() (at Library/PackageCache/com.unity.ugui@1.0.0/Runtime/EventSystem/EventSystem.cs:501)

problem happens here: // Find command's index in the list of registered commands using binary search private static int FindCommandIndex( string command )