How do I load multiple JSONs with a for each loop?

0 favourites
  • 1 posts
From the Asset Store
SynthWave Loop Pack includes 68 seamless loops, founded on 11 original melodies.
  • Hi there,

    This is my setup

    In my application I have 2 Array classes - Category and SubCategory.

    When I create a new entry in the Category, I create a new SubCategory.

    The Category contains the names of all SubCategory. The SubCategory contains a bunch of a data.

    The SubCategory array has a variable with a name (from the Category array).

    My Category Array classes exists all the time and the SubCategory class is created on an event.

    In some events I save the array's data to a LocalStorage plugin - a single key for the categories array, and multiple keys for the multiple SubCategories.

    When I reload the application I

    - Load the data from the Categories key to the Categories array (with localstorage)

    - Run for a Category each X element loop to create the SubCategories and give them names

    Everything to this point works as I want it to.

    And here is my problem:

    I can't find a way to load the data from LocalStorage to each NEWLY created SubCategory.

    The SubCategory has the right name as a variable. And that name corresponds to a key in the LocalStorage.

    I tried to run For Each SubCategory, check SubCategory.Name exists and if it exists load data, but it seems the "if it exists" event is triggered only once, because only of the SubCategories gets loaded.

    Any ideas how to make this setup work suggest a better way to save/load stuff. I am working on Construct 3.

    Thanks a bunch!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)