Search Issue Tracker

Not Reproducible

Votes

5

Found in [Package]

1.4.11f2

Issue ID

UVSB-656

Regression

No

UnityEngine.UI.Selectable -> IndexOutOfRangeException: Index was outside the bounds of the array.

Package: Visual Scripting

-

[Original Issue link|https://support.ludiq.io/communities/5/topics/5187-bolt-bug-unityengineuiselectable-indexoutofrangeexception-index-was-outside-the-bounds-of-the-array]

----

Hello,
I randomly get an error saying I need to rebuild the bolt unit options. And after that I get a bunch of these errors:

IndexOutOfRangeException: Index was outside the bounds of the array.

(wrapper stelemref) System.Object.virt_stelemref_class(intptr,object)

UnityEngine.UI.Selectable.OnEnable () (at C:/Program Files/Unity/Hub/Editor/2019.3.12f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Selectable.cs:493)

They happen on a new empty scene with just UI Button or Input Source for example.

If I revert the project to collab version, then build bolt unit options the error comes back.

  1. Resolution Note:

    Cannot Reproduce, but if the users reporting this issue can provide steps to reproduce, we'll re-open it.

Comments (5)

  1. chris_schubert

    Dec 10, 2021 20:49

    I get it most frequently when using TextMeshPro buttons.

    My workaround:

    [InitializeOnLoadAlways]
    public class DummySelectable : Selectable
    {
    static DummySelectable()
    {
    if (s_SelectableCount < 0)
    {
    s_SelectableCount = 0;
    }
    }
    }

  2. triangle4studios

    May 06, 2021 03:08

    Is Accompanied by this error:

    IndexOutOfRangeException: Index was outside the bounds of the array.
    (wrapper stelemref) System.Object.virt_stelemref_class(intptr,object)
    UnityEngine.UI.Selectable.OnDisable () (at C:/Program Files/Unity/Hub/Editor/2019.4.3f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Selectable.cs:526)
    UnityEngine.GameObject:SetActive(Boolean)
    ActorMenu:SetBackPackInitialPositions() (at Assets/Game/SCRIPT/ActorMenu.cs:1182)
    ActorMenu:OnEnable() (at Assets/Game/SCRIPT/ActorMenu.cs:787)

    as well as

    IndexOutOfRangeException: Index was outside the bounds of the array.
    UnityEngine.UI.Selectable.OnDisable () (at C:/Program Files/Unity/Hub/Editor/2019.4.3f1/Editor/Data/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/UI/Core/Selectable.cs:523)
    UnityEngine.GameObject:SetActive(Boolean)
    ActorMenu:SetBackPackInitialPositions() (at Assets/Game/SCRIPT/ActorMenu.cs:1182)
    ActorMenu:OnEnable() (at Assets/Game/SCRIPT/ActorMenu.cs:787)

    Happens when updating a script while the game is running.
    Is resolved by restarting unity, but occurs again within 15-20 minutes.
    Cannot be resolved without restarting the editor.

    Can be avoided by not updating a script until the game is not running. However many people use live script updating, so this would ruin said feature.

  3. Gaia_vp

    Jan 22, 2021 15:32

    Hi DPOTUZNIK
    would you mind pitting some steps to reproduce, we will appreciate it a lot
    Thanks so much..!!!

  4. dpotuznik

    Jan 20, 2021 12:21

    me too 2020.2.1f1

  5. Synamon

    Sep 22, 2020 15:59

    2019.4.1.f1
    me too

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.