Hello Guest

Author Topic: Tilemap TMX loading through C#  (Read 6025 times)

Donitz

  • Newbie
  • *
  • Posts: 2
    • View Profile
Tilemap TMX loading through C#
« on: July 09, 2013, 06:38:58 pm »
Yello.

Is there any way to import TMX files for a tilemap through C#? I'd love to be able to store information about every ship in my game as a separate TMX file and load them dynamically.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap TMX loading through C#
« Reply #1 on: July 09, 2013, 06:40:06 pm »
You will have to port the code yourself from the editor script. Its not too bad.
The TMX import requires XML and ZLIB and that adds a significant file size overhead to an iOS game, so it can't be part of the core toolkit.

Donitz

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Tilemap TMX loading through C#
« Reply #2 on: July 09, 2013, 06:54:14 pm »
Thank you for the swift reply.

Well, as much as I would like being able to just keep a tmx file for each ship, I don't want to unnecessarily bloat the game. I could just import each tmx file and keep the Render Data for each ship as a prefab right? The problem then of course is that they have to be re-imported for every change done.

Would it also be possible to access the tile properties and object data that I've saved in Tiled from the Render Data?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Tilemap TMX loading through C#
« Reply #3 on: July 09, 2013, 09:47:07 pm »
In your case, it might be better to simply bite the bullet and cope with the overhead. Its unacceptable levels of overhead in a general toolkit, but it should be fine if it'll save you (possibly significant amounts of) time.

Saving render data might not be the best idea - the only way to save it properly is in a scene, and you'll end up with many many scenes if you did it this way. This might not be a bad thing if you write an editor script to automatically update all tilemap scenes from tmx though...

Edit: One more thing - you can't access tilemap info from the render data. You need the tilemap object for that. Scenes might be the best choice here.