Page 1 of 1

Save GameObject state

Posted: Fri Jun 29, 2018 2:28 am
by Seiryu32
So I have a slight dilemma. My game uses a pre-animated life counter with the mecanim. Once a player dies, the scene restarts. The float variable will save, but the counter restarts as well. Are there any actions to save the state of an object not just the variables?

Re: Save GameObject state

Posted: Fri Jun 29, 2018 6:59 am
by Joel
Hi there,

I'm not sure I understand what you mean by saving the state of an object rather than just saving the variables, because an object is just a group of variables and methods.

You can add support for the Component you're saving in Window > Easy Save 3 > Types (see https://docs.moodkie.com/easy-save-3/es ... -es3types/), and select the variables which need to be saved to save the counter (if they're accessible). You can then use the Save and Load actions to save and load the relevant Component.

All the best,
Joel

Re: Save GameObject state

Posted: Fri Jun 29, 2018 8:29 am
by Seiryu32
The counter is controlled with mecanim. So like when a player loses a life, it transitions to the subsequent state. When the scene restarts it resets the counter to it's default state. Anyway to save the transition state?

Re: Save GameObject state

Posted: Fri Jun 29, 2018 8:44 am
by Joel
Hi there,

I see. There would be no way to do this using PlayMaker actions. However, there's a thread on the Unity forums here which describes how you might save and restore the state using code.

All the best,
Joel