Global objects are duplicated after loading the savefile

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.
  • Problem Description

    An object set as global on a layout will create duplicates of itself when revisiting that layout after saving and reloading the game from a different layout.

    Attach a Capx

    [attachment=0:zu1wp9i1][/attachment:zu1wp9i1]

    Description of Capx

    This capx has 2 layouts:

    Layout 1 has 2 buttons for loading and saving.

    Layout 2 has a global object (orange square sprite).

    Steps to Reproduce Bug

    • 1) Launch the game. You'll see Layout A. Counted object = 0.
    • 2) Press Spacebar. You'll be switch to Layout B, and see the orange sprite (global object). Counted object = 1
    • 3) Press Spacebar again. You'll be switch to Layout A. The orange sprite is still present. Counted object = 1
    • 4) Press Save.
    • 5) Close the game and restart it. The orange sprite is gone. Counted object = 0.
    • 6) Press Load. The orange sprite is visible. Counted object = 1.
    • 7) Press Spacebar. You'll be switched to Layout B. Counted object = 2.
    • 8) You can repeat steps # 3 to 7 to create multiple copies of the global object.

    Observed Result

    The orange square global object is duplicated after loading the savefile and revisiting its layout.

    Expected Result

    The orange object is not duplicated after loading the savefile. No new copies of the object gets created.

    Affected Browsers

    • Chrome: YES
    • FireFox: ???
    • Internet Explorer: ???

    Operating System and Service Pack

    Windows 7

    Construct 2 Version ID

    Release 195 (64-bit) - Jan 19 2015

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, should be fixed in the next build.

  • Oh wow, thanks! I was somehow expecting that it would be considered a normal/expected behavior for Construct, especially since I found a way to prevent this issue with some additional code. But yeah, thanks for the fix. It will make the code so much more clean!

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