Global layer unexpectedly persisting on Layout it's not included in

0 favourites
  • 4 posts
From the Asset Store
Globals 2.0
$3.60 USD
10% off
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hey there,

    I recently started playing around with Construct 3 and I'm encountering an odd issue involving Global Layers. I think I must be misunderstanding or misusing them in some form.

    Drive link to a copy of the project I'm trying to debug:

    https://drive.google.com/file/d/1Ew2-8ElB3a-VpnNKvzSqgOAwHvUqjx_u/view?usp=drive_link

    In the linked project I'm trying to create a very basic point-and-click-adventure-style navigation experience. I knew I'd have some basic UI elements that I'd want to be available on almost any view (i.e. a back button back out to the previous scene, but one might also imagine a health bar from an action game). Knowing I wanted the same UI on many different Layouts, I created a GlobalLayers Layout and added a SceneViewHUD Layer to that Layout which I marked as "Global".

    This has mostly worked as intended. I've been able to add the SceneViewHUD layer to several other Scene Layouts without needing to rebuild the HUD for each of those scenes. The issue shows up if I return to a Layout where SceneViewHUD is NOT listed among the Layers for that Layout, and yet it shows up anyways.

    The project opens with a very basic StartScreen Layout which doesn't include the SceneViewHUD Layer. Once the player clicks Start and enters a SceneView, this loads the SceneViewHUD Layer which includes a Back button and a Map button. Currently, the Map button just returns them to the StartScreen view. If a user clicks the Map button though, upon returning to the StartScreen Layout, the SceneViewHUD remains visible even though SceneViewHUD is not included among the Layers of the StartScreen.

    One of the even weirder things is that when running the with the debugger UI, the SceneViewHUD Layer is NOT listed among the visible layers when returning to the StartScreen Layout, even when the Layer IS clearly visible (and SceneViewHUD DOES show up in the list of Layers when I'm on a Layout where it is explicitly included).

    Can anyone help me understanding what's going on here?

    My best guess right now is that maybe something about the Map icon handling the click even is causing it to be held through the Layout change when it shouldn't?

    Much thanks for any and all help!

  • The map icon persists between layouts because it is set to global. You can use the global layer and untick the global option on the object itself. Global objects and global layers are different.

  • omg, thank you so much!

    I don't even remember making those sprites Global but I guess I must have done so when I was first figuring out the persistent HUD.

    Thank you for the help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No problem. If you have any more problem with global layers feel free to respond here, or there is the manual with some useful tips!

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