playMaker

Author Topic: FSM help.  (Read 2123 times)

nabilfx

  • Full Member
  • ***
  • Posts: 186
FSM help.
« on: March 11, 2017, 09:15:20 PM »
I have two scenes, in the first scene I have 2 fsm, one image and one button, and in scene two I have one fsm button. Scene 1 starts with the fsm of the image then I click on the fsm button and goes to scene two, I need that when I click on the fsm button of scene two, return to scene one, only with the fsm of the button on, and fsm of the image off .

I need to go back to the other scene, in a specific fsm.

It's possible?

pXd

  • Playmaker Newbie
  • *
  • Posts: 29
Re: FSM help.
« Reply #1 on: March 12, 2017, 11:45:23 PM »
Get the buttons in the 2 scenes to set the value of a global bool variable.
Then get the image to check if the global bool is true or false and then set whether the image is visible or not.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: FSM help.
« Reply #2 on: March 13, 2017, 01:59:44 AM »
Hi,

-  or you can use PlayerPrefs which allow to save persistant data, which would help in your case.

- you can also use a GameObject set to "not destroy on load" so that it persists as you load and unload scenes, then that object would have fsm and values other fsm in each scene can go and find informations to use.

 Bye,

 Jean

pXd

  • Playmaker Newbie
  • *
  • Posts: 29
Re: FSM help.
« Reply #3 on: March 13, 2017, 03:10:29 AM »
-  or you can use PlayerPrefs which allow to save persistant data, which would help in your case.

I thought of playerprefs but what is the benefit of using persistant data in this case? Wouldn't he want the image and buttons to reset each time the app is run?  ???

nabilfx

  • Full Member
  • ***
  • Posts: 186
Re: FSM help.
« Reply #4 on: March 13, 2017, 10:48:39 AM »
i got it, thanks
« Last Edit: March 13, 2017, 02:13:28 PM by nabilfx »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: FSM help.
« Reply #5 on: March 15, 2017, 08:36:39 AM »
Hi,

 The benefit is persistence between loading, and yes when you start the app, the logic of this particular game may simply not even query this playerprefs at all.

typically, if your game is well made or complex, it should remember the last state it was open, and so you'll find that in complex systems relying on PlayerPref is essential and become part of the logic mechanism entirely, it's not always needed, but something to consider. In the case exposed, I don't know if the game can be resumed directly in the loaded level or in another level, hence the option of using PlayerPrefs which solves both cases.
 
Bye,

 Jean