2D Toolkit Forum

2D Toolkit => Support => Topic started by: trlanfeng on January 13, 2015, 04:24:46 pm

Title: The tilemap have changed when game is running , how to save it ?
Post by: trlanfeng on January 13, 2015, 04:24:46 pm
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     :)
Title: Re: The tilemap have changed when game is running , how to save it ?
Post by: unikronsoftware on January 14, 2015, 10:52:46 am
I think you need to call EditorUtility.SetDirty on the tilemap after modifying it.
Title: Re: The tilemap have changed when game is running , how to save it ?
Post by: trlanfeng 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 ?
Title: Re: The tilemap have changed when game is running , how to save it ?
Post by: unikronsoftware 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.