Global Sprites on Global Layer

  • Problem Description

    When I have global sprites on a global layer, travelling between layouts duplicates the sprites and destroys any information they contain.

    Description of Capx

    There are 4 global square sprites on the top layer. You can click on them to make them change color and increment their instance variable. There is a button on the main layer that takes you to the other layout. Note that when the button is pressed, the layout changes, but the squares

    Steps to Reproduce Bug

    • Start the project in debug mode.
    • Click the little squares to make them change color.
    • Click the button to change layouts Observed Result
    • Notice that all the squares, which are global, have reverted to thier initial state of being green.
    • Notice that the Instance variable, which has been counting clicks, has reverted to 0
    • Notice that there are now 8 squares instead of 4, and that each pair has duplicate UID

    Expected Result

    I am expecting each UI element to be created if it doesn't already exist. If it does already exist, I expect it to keep it's state and instance data.

    I was expecting each of the 4 little squares to retain it's color and instance variable as the layout changes.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES)

    Operating System and Service Pack

    Windows 7, SP1

    Construct 2 Version ID

    Release 198, 64 bit.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Any luck reproducing? or have I misunderstood the intended behavior?

  • It's not a bug that it creates new instances. Since you are using a global layer, it's like copying and pasting that layer's contents to the other layouts. Therefore it's like having another 4 global instances on the second layout. It is working correctly by creating another 4 instances as it goes to the next layout. It's a bug that they have the same UIDs though - this is fixed for the next beta.

  • Thanks for the reply. If I check for and delete the new copies (by IID), should the originals retain their data from the previous layout?

    Edit: Confirmed that all works as it should. Thank you for all that you do Ashley!

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