Global object instance increases on layout change?

0 favourites
  • 8 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.
  • Hey all,

    I have been trying to work on a global UI HUD that is visible on the main game screen, but disappears when transitioning to layout 2. I feel I have successfully been able to accomplish this, however, I have found that my global objects create another copy of themselves in the exact place as the original when I transition from layout 2 back to layout 1.

    This increase in object count seems to only occur per the total number of layouts I transition to from the original. For example, if I had 3 layouts where I transition from layout1>layout2>layout3>layout1, there would be 3 sets of the original global objects.

    I did some research looking at tutorials and searching the forums, but other than this example, , I have not found much that would help with my situation.

    It should be noted that my methods do vary slightly from the link above (in that project the UI page is revisited prior to restarting the main game, however, in my case, I would just like to transition from layout1 to layout2 and back akin to an equipment screen).

    I have attached a capx example for those of you that are interested in taking a look.

    Any guidance would be greatly appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I use a startup layout to create my global objects. This layout only ever gets run once at the start of the game. Maybe that's something you could try?

  • I'm not really sure what you mean, in my capex I am not creating any UI objects via create or spawn, any object creation is just from manual placement in the UI layout.

  • A global object does not get destroyed when you move to another layout.

  • A global object does not get destroyed when you move to another layout.

    Hi Lennaert,

    Thanks for the reply. I understand that a global object is not destroyed when moving from one layout to another. I am more confused as to why the number of instances of my global object increases when transitioning between layouts.

    From my understanding, I should only have 1 instance of each global object, that does not increase as I transition between layouts, especially in the event where the global objects are exclusively created via placement in the editor (as in my capx).

    I just cant quite see what I am missing here....

  • You also use a global layer .....

  • Doh, so simple and obvious, I'm embarrassed I did not notice it myself.

    Thank you Iennaert !

  • No worries, as I said earlier to another scirrian, it happens to the best of us

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