Hello Guest

Author Topic: TileMap bug with SpriteCollection containing 2+ sprite sheets  (Read 4470 times)

hemdanw

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 11
    • View Profile
TileMap bug with SpriteCollection containing 2+ sprite sheets
« on: August 04, 2012, 04:36:36 pm »
Hi,

Hopefully I am not doing something wrong here, but I was able to get this problem more than once.

When I create a sprite collection with 1 sheet and use it in a tilemap everything worked.

When I create a sprite collection with 2 tile sheets (1 for background tiles, and 1 for foreground collidable tiles), I started getting the error below. I split my tiles across 3 tile sheets, foreground box trimmed collidable, background, and a tile sheet for tiles that will be shared across scenes. It seems that for the shared tile sheet, if I insert it into the sprite collection I would be replicating the tiles into multiple atlases which would be inefficient... The alternative solution would be to accept multiple sprite collections in the tile map, but that does not seem to be supported at the moment??

More information about my setup. I am using tk2dCamera. Adding a sprite collection with 2 sprite sheets to a tilemap breaks the tilemap renderer. Both tile sheets are made of 16 tiles across x 16 tiles top-to-bottom, with each tile being 64x64 pixels. This required expanding my tile sheet atlas to 2048 (but I'm still using 1 atlas). When I added the 2nd tile sheet to the sprite collection it appeared correctly, and the all elements appeared in the TileMap/Paint editor, but the TileMap no longer appeared in the scene and no tiles can be added. I noticed the error below. Removing the 2nd tile sheet from the sprite collection did not fix the issue.

Other information, I'm using 2d Toolkit, v1.76 final + patch 1 with Unity 3d v 3.5.4f1 on a Win64 system.

Thanks,
   hemdanw

MissingReferenceException: The object of type 'Material' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
tk2dEditor.BrushRenderer.DrawBrush (.tk2dTileMap tileMap, .tk2dTileMapEditorBrush brush, Single scale, Boolean forceUnitSpacing, Int32 tilesPerRow) (at Assets/TK2DROOT/tk2d/Editor/Tilemap/tk2dTileMapBrushRenderer.cs:223)
tk2dTileMapEditor.DrawSettingsPanel () (at Assets/TK2DROOT/tk2d/Editor/Tilemap/tk2dTileMapEditor.cs:767)
tk2dTileMapEditor.OnInspectorGUI () (at Assets/TK2DROOT/tk2d/Editor/Tilemap/tk2dTileMapEditor.cs:1020)
UnityEditor.InspectorWindow.DrawEditors (Boolean isRepaintEvent, UnityEditor.Editor[] editors, Boolean eyeDropperDirty) (at C:/BuildAgent/work/d9c061b1c154f5ae/Editor/Mono/Inspector/InspectorWindow.cs:888)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: TileMap bug with SpriteCollection containing 2+ sprite sheets
« Reply #1 on: August 04, 2012, 07:51:20 pm »
Can you drop me an email (support@unikronsoftware.com), please? I have a fix which isn't in 1.76 + patch1, it should in theory fix this. Multiple tile sheets are definitely supported, I've had them working numerous times, so if there is any issue I'll get them sorted out.