0 Favourites

Question about global objects...

This forum is currently in read-only mode.
  • I learned the hard way that having a global object on every layout is a recipe for disaster, since you're going to end up having a million copies of the same object.

    My question is, should I have all global objects on one layout when the application begins that the player CAN'T return to? Right now, I have Title Screen -> File Selection - > World Map, etc., etc. On that first layout, the title screen, is where all the global objects are created. However, the player can cancel out of the file selection and return to the title screen at any time. Wouldn't this end up creating another batch of global objects each time, thus causing problems? So correct me if I'm wrong, but wouldn't the ideal solution would be to have a layout before ANYTHING in the game begins that stores all the global objects, that the player can't return to?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I only use global on a few objects, xaudio, function, keyboard & mouse etc and I do use a layout at the start for those objects. It is going to be a splash screen or something so it will be useful but there won't be any reason to go back to it.

  • No, having a global object on the first layout will not result in more instances being made if you leave that layout then go back to it. You can check for yourself how many instances there are via the debugger.

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