Global object duplicating between layouts

0 favourites
  • 2 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • Hello,

    I dont know if I have to post here this, but I suppose I am doing something wrong.

    I have 2 global objects (9-patch and text) that are always on screen with opacity 0 in a UI layer. When I have to display some text I set its opacity to 100 and show the text. This objects are created in the first layout, and its layer (UI) is also global, to override it every layout.

    The problem is that every new layout, a new instance of both objects are created, so I lose the reference to the first object IID. And I only want one copy of them.

    Why is this happening?

    Edit:

    I have just tried to turn UI layer to "no global", and seems to work fine. So, my question now is, a global layer, duplicates its content every layout?

    Edit 2:

    Ok, I think i figured it out how it works.

    -A global layer with "no global" objects, destroy its objects at the end of a layout and create new ones with new UIDs at the start of the next layout

    • A global object, persist with the same UID between layouts
    • A global object in a global layer persist between layouts with the same UID and also, a new instance of the same global object is created because of the global layer. Is this correct?
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Any object in a global layer is global so you don't need to also make the object global. If you do this, it keeps the global object between layouts and then creates everything from the global layer as well.

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