Hello Guest

Author Topic: The tilemap have changed when game is running , how to save it ?  (Read 4414 times)

trlanfeng

  • Newbie
  • *
  • Posts: 2
    • View Profile
I'm finding the way to build my game , I see 2D TOOLKIT support tilemap . I have a question and I didn't found a answer in Script Reference , so I hope get some help in the forum .

For example ,
The tilemap I had finished the tilemap in the editor , as default , the position of 1,1 is an NPC named "A" , when game is running , the player get 1 coin , then the NPC change to B .
how to save the changed tilemap ? when the game open next time , at the position 1,1 still is B NPC ?
can 2DTOOLKIT save the changed tilemap to a file or a string , when next time open , load the changed tilemap ?

My English , not very well , I hope you can understand me     :)
« Last Edit: January 13, 2015, 04:31:14 pm by trlanfeng »

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: The tilemap have changed when game is running , how to save it ?
« Reply #1 on: January 14, 2015, 10:52:46 am »
I think you need to call EditorUtility.SetDirty on the tilemap after modifying it.

trlanfeng

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: The tilemap have changed when game is running , how to save it ?
« Reply #2 on: January 14, 2015, 01:22:52 pm »
Thanks for your answer . But if I need to start a new game , I can't find the default tilemap anymore ?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: The tilemap have changed when game is running , how to save it ?
« Reply #3 on: January 14, 2015, 02:18:37 pm »
If you're changing it WHILE the game is running, you can't save that automatically, you'll need to save the tiles that you've changed somewhere.