Do Something only once

0 favourites
  • 2 posts
From the Asset Store
Change the size and position of everything without calculating anything!
  • Until now, I have been doing my static initialisation in a "on start of layout".

    However, on mobile, the user can switch between portrait and landscape layouts. Each time they switch back to portrait, I am guessing that "On start of layout" is run (although I dont know this for sure).

    The question is, how to only run something once ever, no matter how many times the layout is swapped?

    E.g. could I do:

    Global DoneInit = 0
    System DoneInit = 0 -> System set DoneInit to 1
                        -> (do static initialisation of stuff)


    And this only ever get called once, or do global vars also get re-initialised when you switch layouts?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Your example should work fine, only running once ever (during the running of the project). 'On start of layout' is only ever run at the start of layout and is not called again even if the orientation/window size changes.

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