IndexOutOfRangeException in TileMap grid
See original GitHub issueI’ve got an IndexOutOfRangeException by painting some tiles:
[Edit] Error: An error occurred: IndexOutOfRangeException: Index was outside the bounds of the array.
CallStack:
at Duality.Grid`1.get_Item(Int32 x, Int32 y) in c:\projects\duality\Duality\Utility\Grid.cs:line 91
at Duality.Editor.Plugins.Tilemaps.CamViewStates.FillTilemapTool.FloodFillTiles(Grid`1& fillBuffer, Grid`1 tiles, Point2 pos, Int32 maxTileCount, Point2& fillAreaTopLeft, Point2& fillAreaSize) in c:\projects\duality\DualityEditorPlugins\Tilemaps\CamViewStates\TilemapTools\FillTilemapTool.cs:line 167
at Duality.Editor.Plugins.Tilemaps.CamViewStates.FillTilemapTool.GetFloodFillArea(Tilemap tilemap, Point2 pos, Boolean preview, Grid`1 floodFillArea, Point2& floodFillOrigin) in c:\projects\duality\DualityEditorPlugins\Tilemaps\CamViewStates\TilemapTools\FillTilemapTool.cs:line 128
at Duality.Editor.Plugins.Tilemaps.CamViewStates.FillTilemapTool.UpdatePreview() in c:\projects\duality\DualityEditorPlugins\Tilemaps\CamViewStates\TilemapTools\FillTilemapTool.cs:line 71
at Duality.Editor.Plugins.Tilemaps.CamViewStates.TilemapEditorCamViewState.UpdateActiveState() in c:\projects\duality\DualityEditorPlugins\Tilemaps\CamViewStates\TilemapEditorCamViewState.cs:line 379
at Duality.Editor.Plugins.Tilemaps.CamViewStates.TilemapEditorCamViewState.OnMouseMove(MouseEventArgs e) in c:\projects\duality\DualityEditorPlugins\Tilemaps\CamViewStates\TilemapEditorCamViewState.cs:line 645
at Duality.Editor.Plugins.CamView.CamViewStates.CamViewState.OnMouseMove() in c:\projects\duality\DualityEditorPlugins\CamView\CamViewStates\CamViewState.cs:line 617
at Duality.Editor.Plugins.CamView.CamViewStates.CamViewState.RenderableControl_MouseLeave(Object sender, EventArgs e) in c:\projects\duality\DualityEditorPlugins\CamView\CamViewStates\CamViewState.cs:line 873
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnMouseLeave(EventArgs e)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
[2D] Multiple errors thrown continuously on resizing the grid ...
When Tilemap Grid size is changed from Inspector then it causes the editor to throw IndexOutOfRangeException, GUI Error, OverflowException ...
Read more >Question - Tilemap LockPosition Only?
IndexOutOfRangeException: Index was outside the bounds of the array. UnityEditor.Tilemaps.HandlePositionRotationBrush.BoxFill (UnityEngine.
Read more >IndexOutOfRangeException thrown if Tileset is switched on ...
An IndexOutOfRange exception is thrown if the selected Tilemap's Tileset is switched. This exception only occurs if the Tileset has been painted ...
Read more >[Bug] IndexOutOfRangeException when zooming in/out on ...
With v1.4.2, when zooming in/out on the Zoomable Map example, there are continuous errors with the following call stack.
Read more >Why is my tilemap smaller than my grid? how do I fix this?
It basically sets how big each pixel is in regards to editor scale. The tile map has the same value on it too....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Got it! The bug wasn’t actually related to the repro steps, but occured when click-dragging the fill tool across a tilemap border, i.e. starting an operation on a valid tile and holding the mouse button while moving the cursor so it would hover a tile out of range.
Fixed, binary package update on its way. Should be available in about 10 minutes.
I checked on this again, and the message dialog actually does pop up - but only when you attempt to close the Tileset editor or deselect the Tileset. As long as you keep it open and don’t select a different Resource, you won’t get the dialog.
Experimented with showing it when tabbing the editor away in addition to closing it, but that turned out to be too annoying to make it the regular behavior. Tabbing away an active editor is something that does happen in regular workflows a lot - without necessarily meaning that the previous operation needs to be applied.
End result: I’m going to leave the dialog behavior as is for now.
I can’t reproduce the bug here using the steps and regardless of whether or not I hit Apply. Are you reproducing the bug in a new, empty project? Can you go into more detail what exactly you’re doing, i.e. “what buttons you’re pressing in which order”? Also, can you upload the
.png
file of the tileset you’re using?