playMaker

Author Topic: (solved) ES3 Arraylist Save/Load issue  (Read 1228 times)

Aaddiction

  • Full Member
  • ***
  • Posts: 166
(solved) ES3 Arraylist Save/Load issue
« on: February 06, 2022, 11:18:05 AM »
Sorry for opening another topic, but I have another issue.
I created a save-load flow in the following manner:

One object with with two custom global transitions: Save and Load.

In the Save state (state 2 from the attachment) I have the action ES3 Arraylist Save, where I save the array of total wins. Each car is an index of the array.

In the Load State (state 3 from the attachment) I have the action ES3 Arraylist Load, where I load the array of total wins.

I run Save when I leave the scene and Load when I enter the scene.

The issue: Array List Set action does not work when I do the above. It does not add int value (+1) to the car-total-wins array. All the array values stay at 0.

When I disable the the load action the wins are added to the array, but even if I win 3 times the value in the Array is always 1 in the menu-scene (where the array proxy is) because the array is destroyed and not saved with ES3 action when the race scene is loaded.

Could I please get some help how to not lose (save/load) array values between scenes with ES3 actions and change the array values at the same time.

Thank you in advance.

EDIT: I think I figured it out.
1. I need to save after every action that is changing an array, not only before leaving the scene as the time for save might not be enough.
2. I need to run the save action before everything else at least once so the keys can be created.

With that said it would be good if the save and load array action have success event.
« Last Edit: February 06, 2022, 12:57:17 PM by Aaddiction »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7615
    • jinxtergames
Re: (solved) ES3 Arraylist Save/Load issue
« Reply #1 on: February 06, 2022, 08:33:33 PM »
Hi.
Using singleton and a 'Meta Data' Global game object is a lot easier in the end.
as i explained in this post :
https://hutonggames.com/playmakerforum/index.php?topic=24680.msg106936#msg106936

The scripts from easy save does not send a success event only an error event as far as i know.
that's probably why the actions don't have a success event.

To make sure a file save is create you can use 'File Exists' or Key Exists'
then if not, save 1st.

Aaddiction

  • Full Member
  • ***
  • Posts: 166
Re: (solved) ES3 Arraylist Save/Load issue
« Reply #2 on: February 07, 2022, 04:07:07 AM »
Thank you. Yes, nice to know about singleton manager action, I wasn't aware of it.

No need to use at that point since I managed to get the save and load array actions working. Also, you still would need to save load when you launch or exit the game.
« Last Edit: February 08, 2022, 05:04:37 AM by Aaddiction »