Hello Guest

Author Topic: Couldn't import tmx into tilemap editor  (Read 5173 times)

kimsama

  • Newbie
  • *
  • Posts: 2
    • View Profile
Couldn't import tmx into tilemap editor
« on: November 16, 2013, 04:19:44 pm »
Hello,

I'm using 2D toolkit 2.2.3 on Unity 4.2.1f4.

When I imported the attached tmx file I got the following error:

IndexOutOfRangeException: Array index is out of range.
tk2dRuntime.TileMap.Layer.FindChunkAndCoordinate (Int32 x, Int32 y, System.Int32& offset) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:356)
tk2dRuntime.TileMap.Layer.GetRawTileValue (Int32 x, Int32 y, System.Int32& value) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:368)
tk2dRuntime.TileMap.Layer.GetTileFlags (Int32 x, Int32 y) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:412)
tk2dRuntime.TileMap.Layer.SetTile (Int32 x, Int32 y, Int32 tile) (at Assets/TK2DROOT/tk2dTileMap/Code/tk2dTileMapChunks.cs:434)
tk2dEditor.TileMap.Importer.PopulateTilemap (.tk2dTileMap tileMap) (at Assets/TK2DROOT/tk2dTileMap/Editor/Importer/tk2dTileMapImporter.cs:188)
tk2dEditor.TileMap.Importer.Import (.tk2dTileMap tileMap, Format format) (at Assets/TK2DROOT/tk2dTileMap/Editor/Importer/tk2dTileMapImporter.cs:229)
tk2dTileMapEditor.DrawSettingsPanel () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditor.cs:764)
tk2dTileMapEditor.OnInspectorGUI () (at Assets/TK2DROOT/tk2dTileMap/Editor/tk2dTileMapEditor.cs:1171)
UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty) (at C:/BuildAgent/work/cac08d8a5e25d4cb/Editor/Mono/Inspector/InspectorWindow.cs:888)
UnityEditor.DockArea:OnGUI()

The attached file contains tile image file and its tmx file except original level image file.

Any ideas?


-Kim

« Last Edit: November 16, 2013, 04:21:38 pm by kimsama »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Couldn't import tmx into tilemap editor
« Reply #1 on: November 16, 2013, 10:04:55 pm »
Looks like a bug.
You can fix this by changing changing tk2dTileMapImporter.cs, line 186.
Code: [Select]
int offset = (!staggered || (staggered && ((y % 2) == 0))) ? 0 : 1;

kimsama

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Couldn't import tmx into tilemap editor
« Reply #2 on: November 17, 2013, 03:08:33 pm »
Thank you.

It works now.


- Kim