Mac Simulator initializes game twice

OS: macOS
SDK version: 1.2.1

I noticed that my initialization code was sometimes run twice in the Simulator.

Let’s take the simplest project:

function playdate.update()
  1. Create a pdx
  2. Verify that the Simulator is not running
  3. Double click on the pdx
  4. See that “load” is displayed twice in the Simulator console

If the Simulator is running the game is initialized only once

1 Like

I also see this.

It happens so quickly only my first debug statement is printed twice.

I also noticed this beginning to happen recently.

I think what’s happening is that when the simulator launches it automatically loads the last-loaded game, and I think a recent change made it so that on launch it’ll load and run enough of the last game to log initial debug statements to the console, before proceeding to replace it with whatever its launch argument game was, which is what makes those early print statements appear twice.

I thought it was that too but I checked and it runs the init twice even for a new builds. It is never the previous game initialization.

1 Like