Hello Guest

Author Topic: Recovering a Tilemap  (Read 4320 times)

borrismoose

  • Newbie
  • *
  • Posts: 4
    • View Profile
Recovering a Tilemap
« on: September 04, 2012, 06:45:11 pm »
I've got a tilemap that I was working on in a scene (consisting of tileMapData and tileMapEditorData) which I am trying to recover because the scene got corrupted and deleted itself.

When I create a new tilemap game object and manually set the two data fields with existing data it does not load the tiles into the scene. I have tried committing and serializing to force the issue but it doesn't load the tilemap information.

It is not the tilemap data itself that causes the problem as if I perform this step with any tilemap data the problem persists, and the other tilemaps I have access to work in other scenes.

Is this known behavior or does a fix exist?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Recovering a Tilemap
« Reply #1 on: September 04, 2012, 06:57:53 pm »
The tilemap tiles are stored within the scene itself. Unfortunately in this case, the best option is to try and get an older version of the scene from version control or a backup. If the scene got corrupted and you don't have a backup, you're out of luck :(

The data objects & editor data objects contain information you might want to share between scenes, like tile configurations, layer set-up and brush presets (when the feature is exposed).

borrismoose

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Recovering a Tilemap
« Reply #2 on: September 04, 2012, 07:09:41 pm »
So the tileMapData does not store a data structure that describes the composition of the tilemap? Because as I understood it, tileMapData stored pretty much that and the editor data stored settings used by the editor pane? Although looking through the source seems to indicate otherwise.

I am confused now, when a tilemap is in a scene, whereabouts is the tile information stored? How does this work with prefabs / serializing the data. I have managed to make a tilemap and its render data into a prefab (contained within a parent gameobject) and then place it back into the scene whilst retaining the information. Although I did have to toggle the commit button.

Would you be able to recommend an alternate, more source control friendly method of saving the tile information? At the moment we are working within one scene file but we cannot continue with this method moving forward.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Recovering a Tilemap
« Reply #3 on: September 04, 2012, 08:15:57 pm »
The tilemap contents (i.e. the tiles you've painted) is stored within the tilemap object itself. Creating a prefab means it will be stored in the prefab as well - as you discovered you'll need to recommit to regenerate the data, but that's pretty much it. Of course, you'll need to update the prefab object when you paint in the scene. (i.e. click "Apply").

Have you tried text serialization in Unity? That will let you merge changes when working with multiple people. Its really almost perfectly fine when multiple users don't edit the same part of the file (i.e. the same objects) at the same time. With the tilemap, you could even merge changes if people painted into the same regions, though it could be a bit tricky.