ArgumentOutOfBoundException on RuleTile

Hi,

I have the following problem: Whenever I create a Rule Tile (from the 2D Tilemap Extras package) or if I select a created Rule Tile I get an ArgumentOutOfBoundException. This seems to happen in the packages code, not in my game code:

ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <6073cf49ed704e958b8a66d540dea948>:0)
UnityEditor.RuleTileEditor.GetElementHeight (System.Int32 index) (at Library/PackageCache/com.unity.2d.tilemap.extras@2.2.3/Editor/Tiles/RuleTile/RuleTileEditor.cs:293)
UnityEditorInternal.ReorderableList.CacheIfNeeded () (at <a017e354f3154926a5617fbac3a64fcc>:0)
UnityEditorInternal.ReorderableList.DoListElements (UnityEngine.Rect listRect, UnityEngine.Rect visibleRect) (at <a017e354f3154926a5617fbac3a64fcc>:0)
UnityEditorInternal.ReorderableList.DoLayoutList () (at <a017e354f3154926a5617fbac3a64fcc>:0)
UnityEditor.RuleTileEditor.OnInspectorGUI () (at Library/PackageCache/com.unity.2d.tilemap.extras@2.2.3/Editor/Tiles/RuleTile/RuleTileEditor.cs:545)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass59_0.<CreateIMGUIInspectorFromEditor>b__0 () (at <5cf6bb2c14f1476f9cd6b153e70ca8b2>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

This error won’t stop the game from launching and I don’t see any other negative consequence, it’s just quite annoying. So if there is a rather simple solution you know, I’d take it. Since I dind’t find some kind of “official” support for this package I hope to find a solution here.

Can anyone help with this?

Cheers!

Smells like it might be a Unity editor thing perhaps? Check the stack trace in the bottom part of the log.

If it is not, here are some notes on IndexOutOfRangeException and ArgumentOutOfRangeException:

http://plbm.com/?p=236

Steps to success:

  • find which collection it is (critical first step!)
  • find out why it has fewer items than you expect
  • fix whatever logic is making the indexing value exceed the collection
  • remember you might have more than one instance of this script in your scene/prefab

Ok, I didn’t find the error and just reinstalled Unity. So it may indeed had to do with the Editor.

Cheers!