Hello Guest

Author Topic: TileMap high disk space usage  (Read 4093 times)

ComputerNerd

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 18
    • View Profile
TileMap high disk space usage
« on: August 01, 2016, 01:08:00 am »
Hi,

I have a concern about disk space usage with the TileMap.  Specifically, it is with the TileMapData asset.  I am not using Prefab placeholders, but the 2D Toolkit fills in the prefab list anyway by default - with a lot of data.

http://imgur.com/a/T6ffN


As you can see, a list got generated by the TileMap with 2,444 empty game objects.  For one single scene.  This causes the asset to balloon 40 KB.  It may not sound like much, but my game will have north of 400 scenes.  It has now become a 16 MB problem.  Instead of defaulting this serialized field to max tile count, I was wondering if you could work in an update that would only populate this list as needed.


Thank you,
Brian
« Last Edit: August 01, 2016, 07:13:19 am by ComputerNerd »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: TileMap high disk space usage
« Reply #1 on: August 01, 2016, 11:17:10 am »
Hiya,

Do you reuse these tilemapdata objects at all? If you're sharing sprite collections in these levels, you can safely share these assets - they're meant to be 1:1 with the sprite collection, but not necessarily unique for all tilemaps. This would be the recommended solution.

If not, and you don't use prefabs at all, the easiest and quickest thing to do would be to remove the [SerializeField] from tileInfo in tk2dTileMapData to stop it from serlializing to disk. The way the UI works, it won't cope with a sparse list - so stopping it saving would be your best bet here.

ComputerNerd

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: TileMap high disk space usage
« Reply #2 on: August 02, 2016, 01:32:10 am »
Thanks for the quick reply!

I have tried reusing the same TileMapData object between scenes using the same Sprite Collection.  The Tile Map render ends up garbled in the second scene to load.  The layer ordering gets messed up.  I think it may  be due to the fact that I load the tmx files at runtime.  I'll play with it more.

The tmx files use different layer counts and different layer names.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: TileMap high disk space usage
« Reply #3 on: August 03, 2016, 10:37:35 pm »
Hiya, the layers are stored in the tilemapdata, so this could be problematic for you if you have different naming schemes / layers. The other option of not serializing the tileInfo field still stands, that should just work in your case.