How do I Fix My Global Layer

Just started using Construct 2? Post your questions here

Post » Wed Jan 13, 2016 11:36 pm

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.
B
6
S
1
Posts: 22
Reputation: 446

Post » Thu Jan 14, 2016 3:14 pm

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!'
B
14
S
2
Posts: 31
Reputation: 887

Post » Thu Jan 14, 2016 10:51 pm

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.
B
6
S
1
Posts: 22
Reputation: 446


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 3 guests