How do I Fix My Global Layer

0 favourites
  • 3 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 all,

    I tried looking for a solution but couldn't find anyone having a similar problem. I have a UI/HUD in a global layer in its own layout, all the objects in it are global also and have the persist behaviour. However when I go to another layout the objects on my global layer seem to duplicate on top of the previous ones. It's hard to explain because it's a odd thing but basically it just recreates everything again on top of the previous one in game, also with fresh variables even though the previous one is below it with its old changed variables.

    There's no events for it that do anything but add or change a variable/visibility, no on start of layout ones or anything of the sort so I'm wondering if theres something I overlooked using a global layer. If it helps I'm just doing the basic, go to layout: level 3 type event when changing level because I assumed a global layer just stayed persistant over all layouts (it has the same layers too but theyre all empty except the top one which has the ui on it).

    If anyone could help me understand I'd be very thankful.

  • I had a very similar situation just a few days ago! The regenerating of the global objects on the global layers.

    And, as far as I found, the global layers seems persistent on every layout, by destroying every objects on a layout's end, and then regenerating them on the new layout. But here, the objects are also global objects, they are not destroyed on the layout's end, so they remain, and the new layout's new objects (for global layer) are generated (without checking whether there is remaining objects or not.)

    I don't know why it should work this way, but anyway it does...... maybe we should ask Ashley. I was making a HUD too, faced this problem, and solved the HUD's duplicating issue by this way: https://www.scirra.com/forum/how-do-i-prevent-global-objects-regenerated_t166734 take a look at the reply starts with 'I solved the problem!'

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you soooo much! I got it fixed in my game now, I don't know if i ever would've figured that out. It's definitely something that needs to be explained a bit more as I couldn't find anything on it and it gave me quite a bit of trouble. I really appreciate your help.

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