Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: protozerg on May 30, 2016, 04:50:16 PM

Title: Argument is out of range in Widgets list in UIPanel.cs
Post by: protozerg on May 30, 2016, 04:50:16 PM
Hi there,

I am in trouble with unknown rare error in NGUI.
I has looked for the problem several days, but I have no more idea.

These are logs from Unity below.

Quote
ArgumentOutOfRangeException: Argument is out of range.

Parameter name: index at System.Collections.Generic.List`1[UIWidget].get_Item (Int32 index) [0x0000c] in /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs:633

at UIPanel.UpdateWidgets () [0x00094] in C:\Projects\PachinkoRPG\Assets\Libraries\NGUI\Scripts\UI\UIPanel.cs:1545

at UIPanel.UpdateSelf () [0x0000c] in C:\Projects\PachinkoRPG\Assets\Libraries\NGUI\Scripts\UI\UIPanel.cs:1237

at UIPanel.LateUpdate () [0x00035] in C:\Projects\PachinkoRPG\Assets\Libraries\NGUI\Scripts\UI\UIPanel.cs:1198

(Filename: /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.Collections.Generic/List.cs Line: 633)


  1. UIPanel.cs
  2.  
  3. void UpdateWidgets()
  4. {
  5.     //..... SKIP...
  6.  
  7.     int frame = Time.frameCount;
  8.     for (int i = 0, imax = widgets.Count; i < imax; ++i)
  9.     {
  10.         UIWidget w = widgets[i]; // <----- ERROR! LINE 1545
  11.  
  12.  
I think widgets.Count,its actual list size, was changed while the for loop was in progress.

Because imax value is never changed, there must be an error

if one element of widgets is removed while in progress of for loop.

Please let me know any tips or clue for this problem.

Thanks.

 
Title: Re: Argument is out of range in Widgets list in UIPanel.cs
Post by: ArenMook on June 01, 2016, 08:39:35 PM
Nothing in NGUI will modify the list of widgets during the UpdateWidgets call. I'll venture a guess here and say that you have a UI in one scene that later gets unloaded using UnloadScene, and you never actually transfer your UI's game objects to the new scene?