Hello Guest

Author Topic: Save/Load Tile Map  (Read 4539 times)

zeteginara

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 38
    • View Profile
Save/Load Tile Map
« on: March 18, 2014, 02:24:32 pm »
So, I've decided that it is probably a good idea to have 'one scene' for most or all of my 2D game, and constantly use the one tile map to draw stuff from levels stored in data format.

But, of course, I don't want to write XML (or whatever I use) to build my levels, I want to draw them in 2Dtoolkit then save/load them.  Is there an easy, built in way of doing this?  Or will I have to write it myself?  If the latter, any pointers?

Neeko

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 59
    • View Profile
    • Overdeveloped
Re: Save/Load Tile Map
« Reply #1 on: March 18, 2014, 02:53:19 pm »
I would imagine it would be as easy as creating your tilemaps as normal in a scene, saving the generated tilemap prefabs under the Resources folder, and then programmatically loading them like any other game object (http://answers.unity3d.com/questions/12003/instantiate-a-prefab-through-code-in-c.html)

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Save/Load Tile Map
« Reply #2 on: March 19, 2014, 10:19:19 am »
Or just save them as different scenes, then use LoadLevelAdditive to load the level with your tile map in it.

Neeko

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 59
    • View Profile
    • Overdeveloped
Re: Save/Load Tile Map
« Reply #3 on: March 19, 2014, 05:37:49 pm »
Or just save them as different scenes, then use LoadLevelAdditive to load the level with your tile map in it.

Yep, this would work well too!