playMaker

Author Topic: It is possible to save playmaker state?[SOLVED]  (Read 2106 times)

nabilfx

  • Full Member
  • ***
  • Posts: 186
    • View Profile
It is possible to save playmaker state?[SOLVED]
« on: March 02, 2019, 12:08:24 PM »
I need to save the values the playmaker image property, after close the app. Then when open again it stil where it was. How can i do that? heres the example.
« Last Edit: April 05, 2019, 07:03:03 AM by jeanfabre »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4616
    • View Profile
    • jinxtergames
Re: Save values after close app
« Reply #1 on: March 03, 2019, 03:57:40 AM »
Hi.
You can use playerprefs to load/save (int, float or string) values or you can get the Easy save asset which has a lot more options and variables to be able to save.

you can save when you change something, or you can use the Application Quit Event (see image below )



And save from there (The event will be triggered when application is closed)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4616
    • View Profile
    • jinxtergames
Re: Save values after close app
« Reply #2 on: March 03, 2019, 04:02:33 AM »
Btw,
you could use "Activate Component" from the Ecosystem instead of the Set Property.

You should always try to avoid Get/Set Properties :)

nabilfx

  • Full Member
  • ***
  • Posts: 186
    • View Profile
Re: Save values after close app
« Reply #3 on: March 03, 2019, 07:23:46 AM »
It is possible to save playmaker state? on quit, then reload it on start?
« Last Edit: March 03, 2019, 02:44:33 PM by nabilfx »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4616
    • View Profile
    • jinxtergames
Re: It is possible to save playmaker state?
« Reply #4 on: March 03, 2019, 11:07:43 PM »
Hi.
Not directly, but you might be able to save the string by using 'Get Fsm State'
Then when starting the game use "GoToStateByName" (you can find it on the Ecosystem)to set the current state on the fsm.

just a mention, start state will always be triggered, so you might want to separate it so that it would do nothing.
But that depends on your setup.


nabilfx

  • Full Member
  • ***
  • Posts: 186
    • View Profile
Re: It is possible to save playmaker state?
« Reply #5 on: March 04, 2019, 08:55:49 AM »
If i put the State 2 at State name it works.
But how can i put anothe State, when the app start again?
It should be the State that suppose to be save at quit app

here attach pic with the exemple

nabilfx

  • Full Member
  • ***
  • Posts: 186
    • View Profile
Re: It is possible to save playmaker state?
« Reply #6 on: March 04, 2019, 09:17:58 AM »
Is not possible to save the FSM, in app momory on Quit?  without SQL
« Last Edit: March 04, 2019, 11:19:46 AM by nabilfx »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4616
    • View Profile
    • jinxtergames
Re: It is possible to save playmaker state?
« Reply #7 on: March 04, 2019, 03:30:56 PM »
Hi.
Not that i know off.

try this :

on each state with the button also have a 'PlayerPrefs Set String' and in the value, place the name of the state where the action is in.
on the 'Key' use the same name on all the actions. (for example "ButtonState")

in the salvar fsm on the start state :
1st have a "PlayerPrefs Has Key" (this is to check if something has been saved already)
and Set a false event to a new state

The new state call it (for example) Create save.
have a 'PlayerPrefs Set String' and place the state name that you want for the button when used for the 1st time (for example "State 3")
add a FINISHED Transition and point it back to the start state.

on the start state (below the "PlayerPrefs Has Key")
also have "PlayerPrefs Get String" (to get the saved value)

Below that, use the "Go To State By Name" and use the string variable you got fro the "PlayerPrefs Get String" action.

Let me know if you got it to work, else i will see if i can make a sample scene.

nabilfx

  • Full Member
  • ***
  • Posts: 186
    • View Profile
Re: It is possible to save playmaker state?
« Reply #8 on: March 04, 2019, 04:07:45 PM »
I can not make it work, can you do a sample scene please.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4616
    • View Profile
    • jinxtergames
Re: It is possible to save playmaker state?
« Reply #9 on: March 13, 2019, 12:25:09 AM »
Hi.
Here is a sample (Attachment below).

The rotating state just has some wait actions and when you stop the game, the current state will be stored.

Then when you start to play, the rotating states will start from the state it was.
« Last Edit: March 13, 2019, 12:29:23 AM by djaydino »

nabilfx

  • Full Member
  • ***
  • Posts: 186
    • View Profile
Re: It is possible to save playmaker state?
« Reply #10 on: March 13, 2019, 07:47:47 AM »
Jean, it works, thank you very much.
« Last Edit: March 13, 2019, 10:43:13 AM by nabilfx »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4616
    • View Profile
    • jinxtergames
Re: It is possible to save playmaker state?
« Reply #11 on: March 13, 2019, 04:25:07 PM »
Hi.
I'm Not jean, but i am happy you got it to work :D

nabilfx

  • Full Member
  • ***
  • Posts: 186
    • View Profile
Re: It is possible to save playmaker state?
« Reply #12 on: March 26, 2019, 02:02:37 PM »
djaydino, the sample you send works great. I have a vuforia playmaker, on image found and lost. I would like to move the (Rotating States) with vuforia playmaker, on image found and lost, let said i stop in the state 4, doing image found and lost, then save the current state in the (Rotating States) as is it now. How can i connect the vuforia playmaker state, to move on an on through the (Rotating States), them on quit, and start again i will continue from there, doing the same on image found and lost.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 4616
    • View Profile
    • jinxtergames
Re: It is possible to save playmaker state?
« Reply #13 on: March 26, 2019, 03:29:26 PM »
Hi.
Sorry i have never used vuforia, maybe you could show me the fsm/actions on a video or images.
So that i have an idea how it works :)

nabilfx

  • Full Member
  • ***
  • Posts: 186
    • View Profile
Re: It is possible to save playmaker state?
« Reply #14 on: March 26, 2019, 07:18:10 PM »
I did it, i figure out thanks, one more thing, is possible to save the state without the press of a buttom with aplication quit? Just by closing the app?