Author Topic: ArgumentOutOfRangeException  (Read 2567 times)

catofong

  • Guest
ArgumentOutOfRangeException
« on: May 16, 2013, 02:03:15 PM »
Hi.

I'm getting an exception and I am stumped as to how to diagnose it cause I can't do a try/catch around Unity's main loop.  Below is the stack from Unity:

ArgumentOutOfRangeException: Index is less than 0 or more than or equal to the list count.
Parameter name: index
279
System.Collections.ArrayList.ThrowNewArgumentOutOfRangeException (System.String name, System.Object actual, System.String message) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Collections/ArrayList.cs:3261)
System.Collections.ArrayList.get_Item (Int32 index) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Collections/ArrayList.cs:2652)
System.Collections.Specialized.OrderedDictionary.get_Item (Int32 index)
UIBasePanel.UpdateWidgets ()
UIBasePanel.LateUpdate ()


We are doing a lot of dynamic creation/destruction of NGUI classes.  My hunch is that UIBasePanel.UpdateWidgets() is going through an array and one of my scripts is removing during the traversal.  However, unless NGUI is on a separate thread, I don't think this is possible cause Unity is single threaded (might be wrong).

Is this something you've seen during your development of NGUI and might have some insight?

We are currently evaluating it using the Free version of NGUI (Version 2.0.7c in the ReadMe.txt).  Is full source only avail in the Professional license version?  Or does the $95 version have all source as well?

Great piece of software.

Thanks,
Cato

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ArgumentOutOfRangeException
« Reply #1 on: May 16, 2013, 02:10:34 PM »
If you are removing widgets during the UpdateWidgets() call, then yes, that's entirely possible.

catofong

  • Guest
Re: ArgumentOutOfRangeException
« Reply #2 on: May 16, 2013, 02:36:02 PM »
Thanks for the quick reply.

I have my main loop that's creating/removing NGUI widgets, which is not inside UpdateWidgets().  The other place where widgets are being created/removed is when I get a input callback from NGUI.  Does the input from UICamera happen inside UpdateWidgets()?

Can you also answer the source code question?

Thanks,
Cato

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ArgumentOutOfRangeException
« Reply #3 on: May 16, 2013, 02:38:50 PM »
Free version is over a year old, and doesn't come with support, and has many issues that have since been resolved or improved on.

Both Standard and Professional licenses come with full source code. Professional simply comes in repository access form, giving you all history and faster updates as well as the ability to submit your own changes and keep up to date easier if you tend to modify code a lot.

catofong

  • Guest
Re: ArgumentOutOfRangeException
« Reply #4 on: May 16, 2013, 04:52:37 PM »
When does the UICamera touch/mouse callbacks happen?  Is it inside UpdateWidget()?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: ArgumentOutOfRangeException
« Reply #5 on: May 17, 2013, 01:16:53 AM »
As I said, free version doesn't come with support. :P