Argument out of range - 2 year old project
Receiving an Argument out of range exception for a 2 year old project that has never thrown this before. I simply highlight my mouse over a Unity UI element and it throws the error.
Unity 2018.4.17f1
Note that I'm able to highlight other UI elements and start the game (even mess with credits). If I resume play it continues like before without issue.
The only thing that I can think of that has changed is that I tried copying the folder to a new location on a separate drive, but I've since gone back to the original project location once this showed up.
I have tried adjusting my layout, as this shows up as a way to resolve it in older posts
Should I delete any meta data associated with this object to try and refresh it?
ArgumentOutOfRangeException: Argument is out of range. Parameter name: index System.Collections.Generic.List`1[UnityEngine.EventSystems.EventTrigger+Entry].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633) UnityEngine.EventSystems.EventTrigger.Execute (EventTriggerType id, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/EventTrigger.cs:212) UnityEngine.EventSystems.EventTrigger.OnPointerEnter (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/EventTrigger.cs:223) UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerEnterHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:22) UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerEnterHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:261) UnityEngine.EventSystems.EventSystem:Update() (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/EventSystem.cs:377)
Answer by VigorousApathy · Mar 29, 2020 at 12:43 AM
Whew, solved it. I had forgotten I tried adding a new script to the button to fade it, but never really finished the script so it was throwing the error. Simply removing this fixed the issue. I got to the solution by slowing rebuilding the button to see what broke.
I do wish the error was not so vague and actually pointed to the problem...but whatever, time to update my game on Steam.
Your answer
Follow this Question
Related Questions
TerrainModify.UpdateArea IndexOutOfRangeException: Array index is out of range 0 Answers
ArgumentNullException: Value cannot be null when slicing mesh 0 Answers
error ArgumentException, game pauses after splash screens 0 Answers
Asset Null Exception - No assetGUID 0 Answers
Array index out of range(C#) 1 Answer