playMaker

Author Topic: Easy Save vs. Unity Serializer  (Read 3406 times)

mathius777

  • Playmaker Newbie
  • *
  • Posts: 38
Easy Save vs. Unity Serializer
« on: June 12, 2013, 09:43:06 PM »
Hello. I need to be able to save the state of my NPCs so that when the level is reloaded, they are in the EXACT state they were in when the game was saved. I have heard that unity serializer can do this, but I kind of wanted to use easy save as it is faster. Therefore, I am trying to think of how I would accomplish this with easy save. Is there a way to set the action of a state machine by name? Thanks.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Easy Save vs. Unity Serializer
« Reply #1 on: June 14, 2013, 01:27:55 AM »
Hi,

 The way I know, is to have in your fsm defined state where you can land on, and so simply define a global event for each of your likely possible landing states, and name it with a convention, like "START / STATENAME", save the state name only, and when you recover or reload your data, fire that event using the statename saved.

 Does that make sense?

It may seems like too much work to have a global event created for each possible landing state, but this is actually much preffered, because you need to design your FSM in a clean way, and I not all states are likely to qualify for serialization, so that enforce some proper thinking about it.

bye,

 Jean

mathius777

  • Playmaker Newbie
  • *
  • Posts: 38
Re: Easy Save vs. Unity Serializer
« Reply #2 on: June 16, 2013, 12:37:27 PM »
This does make sense. And it does indeed seem like a lot of work, and possibly bug prone if I think certain states shouldn't be landable, but weird behavior occurs if I didn't serialize all the states I needed. Thank you for the help though, this confirms the path I need to take.