playMaker

Author Topic: Saving slider value and position  (Read 1487 times)

Bender

  • Playmaker Newbie
  • *
  • Posts: 34
Saving slider value and position
« on: March 01, 2023, 02:57:41 PM »
I have a slider. I change a value, save it, load it, everything is fine. But the slider after loading returns to its initial position and the string also shows the initial value, although the value is changed in the FSM. How to solve this problem?
Please, help.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Saving slider value and position
« Reply #1 on: March 02, 2023, 12:42:55 AM »
Hi.
After loading, how are you setting the slider?

Bender

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Saving slider value and position
« Reply #2 on: March 02, 2023, 12:30:05 PM »
Good question, because I don't know the answer. I'm attaching a screenshot of the FSM. The second screenshot is what I think should be done, but I don't know what exactly. I tried different options, didn't work.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7618
    • jinxtergames
Re: Saving slider value and position
« Reply #3 on: March 03, 2023, 04:21:01 AM »
Hi.
you are only saving there.
also you should not save all the time there

you need to load the variable, then use a ui slider set value.

then on the next state you can get the slider value (make sure its set to every frame, as on your image i can see its not)
and use a float changed which can send a event when the value has changed.
then you can save.

but optimal you should actually only save (for example) when you close a game/menu / load to a different scene / quitting the game

Bender

  • Playmaker Newbie
  • *
  • Posts: 34
Re: Saving slider value and position
« Reply #4 on: March 03, 2023, 09:04:23 AM »
Did it. Thank you very much.