Debugger doesn't always allow a preview

Heya, a lot of the time when I try to debug the game offline, it opens up a preview, but doesn’t allow me to start any kind of debug.

A lot of the time I am met with the above message, despite it automatically opening up a preview window and playing the game. For reference the game is quite large and seems to take about 40-60 seconds to open each scene, an issue I’m working on.

The awfully long loading time might be related, not sure.
Normally, at the top of the debugger, there’s a dropdown to choose which preview instance you want to debug.

Please confirm OS and version of GDevelop.

We hope participate to GSoC 2021, the debugger is in suggested list to thing to rethink.
We hope this feature will be improve.
I add a tag for tracking this possible issue, and if a student of GSoC work on it, i’ll report him this problem.

On Windows 10, with the latest version of GDevelop, 5.00-beta 105.

The loading time might just be because the game is object heavy and I haven’t optimized the pngs yet. But I could be wrong about what’s causing it, cause on other games I’ve started it loads in 2-3 seconds. Thanks.

I just reopened GDev today and the previewer is working fine, while yesterday it didn’t work at all. Seems to be that restarting the program until it works might be the trick but I’m not sure. It might be tied to the sheer number of objects or conditions involved. The game tracks at around 15ms time loss and I’m not experienced enough to know if that’s a huge amount or manageable for a PC game. Thanks again!

One other thing I can think of is that I have a large number of projects saved in the same folder, as in I constantly save backups every few days.

Cleaning up unused resources is very important because every resources in the project are exported before starting the preview.
The preview folder in Windows is in ‘\AppData\Local\Temp\preview’.

Here’s a list of things I’m attempting to do to decrease loading time, will report back so this might be of some help to people. I like to keep notes so might as well post them here.

  1. Removing other project files from the folder (I save a lot of project backups under different names). Seems to help minorly.

  2. Removing dead files from resource menu, also helps performance in a tiny bit.

  3. Cutting down on For Each Objects, helps a good bit (about .5-1ms time save). I’m still shaving where I can but from what I can tell this does help, but not with loading time, but I still do have a bit to go so I will update this based on what I learn.

  4. Optimizing events, prioritizing the rarest conditions first (i.e., mouse is down, rather than cursor is on object). I’ll also try adding "number of objects >= 1, just to see if this helps as an initial check.

Edit^^ adding “number of conditions” helps immensely.