Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Bug in 2019.3.0f6 Index was outside the bounds of the array from com.unity.ugui

Discussion in 'Editor & General Support' started by afftar, Jan 29, 2020.

  1. afftar

    afftar

    Joined:
    Apr 18, 2014
    Posts:
    65
    I try to switch to 2019.3.0f6 and get this error when opening the scene:

    IndexOutOfRangeException: Index was outside the bounds of the array.
    UnityEngine.UI.Selectable.OnDisable () (at com.unity.ugui/Runtime/UI/Core/Selectable.cs:523)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    AND

    IndexOutOfRangeException: Index was outside the bounds of the array.
    (wrapper stelemref) System.Object.virt_stelemref_class(intptr,object)


    This happens at all Buttons in scene. These are ordinary Unity buttons, without overload.
    This prevents me from building an Android project.
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    If it is a Unity bug you should file a bug report with Unity. Posting to the forum doesn't necessarily get Unity developer attention.
     
  3. APSchmidtOfOld

    APSchmidtOfOld

    Joined:
    Aug 8, 2016
    Posts:
    4,473
    I just updated my project to 2019.3.0f6; this project has a collection of buttons too but I didn't get that error. Does this happen only if your project "Current Platform" is set to Android (or whatever it's called)?

    Does the error message still shows when you close your project and restart it?
     
  4. Cool_Flow

    Cool_Flow

    Joined:
    Apr 14, 2013
    Posts:
    21
    It has to do with v1.1.4 of Visual Studio Code. The code is way too complex for me. But I found an easy fix. Goto your package manager, and find "Visual Studio Code Editor", click "See all versions" and update to v1.1.3. This fixes it.

    Visual Studio Code v1.1.4 package says "2019.3 verified" but clearly it's not.

    I did report the bug as well.
     
    Last edited: Feb 2, 2020
  5. afftar

    afftar

    Joined:
    Apr 18, 2014
    Posts:
    65
    Error occurs on ALL buttons on the scene. But as it turned out, for this it is enough to have 1 button with override "Enable" method.(Only one button broken all others and you dont understand what is it) So, to fix this error you need call base.Enable from your override method.
     
  6. amesa_unity

    amesa_unity

    Joined:
    Oct 16, 2019
    Posts:
    5
    I have the same issue with sliders in my project :/
     
  7. michaeleconomy

    michaeleconomy

    Joined:
    Aug 28, 2018
    Posts:
    58
    Did anyone report this bug? The unity team will not often take action unless you submit a bug report.


    I'm getting this on 2019.3.14f1

    I submitted a bug report: 1251281
     
  8. JonInception

    JonInception

    Joined:
    Feb 25, 2018
    Posts:
    7
    I couldn't find your bug report - could you please link so I can upvote?

    I've also gotten this issue in 2019.3.15 on UI.Selectable - had to downgrade to 2019.2, sucks because it took a while to convince management to upgrade :(
     
    Last edited: Jun 7, 2020
  9. sand_lantern

    sand_lantern

    Joined:
    Sep 15, 2017
    Posts:
    207
    Still seems to be a problem in Unity 2019.4. If you ever override Selectable behavior and don't make sure to call the base.Whatever() method, you're awash with errors in the console.
     
  10. GironTordin

    GironTordin

    Joined:
    May 1, 2019
    Posts:
    5
    I have the same thing occuring for me. I just upgraded to 2019.4 LTS, and everything was working fine before. Now this is occuring all of a sudden. Anyone know the status here?
     
  11. sand_lantern

    sand_lantern

    Joined:
    Sep 15, 2017
    Posts:
    207
    Make sure that anywhere you override Selectable methods, you call the base method within the override if you can. They do a lot in the "OnSelected" methods and the likes that needs to happen or else they don't work right.
     
  12. GironTordin

    GironTordin

    Joined:
    May 1, 2019
    Posts:
    5
    I dont override any Selectables at all.
     
  13. sand_lantern

    sand_lantern

    Joined:
    Sep 15, 2017
    Posts:
    207
    Then I can't offer any better insight as to what's happening. When I've seen that error, it was because one of my scripts overrided some Selectable methods, or a sublcass thereof.
     
  14. euming_lee

    euming_lee

    Joined:
    Mar 1, 2016
    Posts:
    6
    Look in C:\Program Files\Unity\Hub\Editor\2019.3.12f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\UI\Core\Selectable.cs

    You'll see many virtual functions. One of them is OnEnable().

    If you have:
    void OnEnable()
    {
    }
    You will get this error. You need to call the base class like this:

    void OnEnable()
    {
    base.OnEnable();
    }

    That's what did it for me!

    -Ming