How do I propagate new global layers?

0 favourites
  • 2 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hi,

    I'm making a game that has a number of global layers that appear in each level layout (HUD, in-game menu, etc.)

    Sometimes I realize I need to add new global layers, for example in the in-game menu, I want to put the contents of each menu tab on a different new global layer. The problem is, I have over 25 level layouts already, and I want to add 5 new global layers. I'd rather not go and add over 100 layouts by hand, is there an easier way to do this?

    Ideally, I'd create them once, as sub-layers on an existing global layer, mark them global, select the parent layer and choose an option like "Create global sub-layers on layouts where they don't exist", or something like that.

    I'll see if there's a more automated way to do this in the mean time...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I managed to essentially copy the sublayers into all the layouts with a script by saving the project as a folder and adding the overridden layouts into each map that didn't have them. The inherited_layers.json file was just a copy of the subLayers list from a layout that had the layers inherited.

    If you use this Python script, you use it at your own risk. Make sure you have made a backup first, and you will need to edit e.g. the "map_*.json" wildcard pattern to have it match your map names. It will overwrite the actual layout files. The SID generated is random too, and does no checks if it's a duplicate, so I also opened the project and opened every single map just to make sure it didn't crash.

    pastebin.com/jjvccn2V

    I then moved everything from the parent layer to the respective sub-layer, then made the parent layer non-global, because otherwise it acts weird in combination with the global sublayers.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)