Button object high GPU load in editor

I’ve been experiencing intermittent performance issues while rapidly developing and testing my game. After working progressively through the problem I have noticed that there is some strange behaviour in the editor which then carries across to the preview.

The button object has a disproportionate impact on the GPU load when moving the camera or the specific object in the scene editor. Basically, moving a single button spikes my GPU. I compared this to other common objects by placing a single object in view and comparing static display with grabbing and moving the object rapidly

  • Single Button - Static 4%, Moving 27%
  • Single Text - Static 1%, Moving 6%
  • Resource Bar - Static 1%, Moving 6%
  • Sprite 64px - Static 1%, Moving 6%

Clearly buttons are a huge drain compared to other items. There is more interesting behaviour if we duplicate the objects and retest

  • Two Identical Buttons - Static 8%, Moving 49%
    *Two Identical Sprites 64px - Static 1% Moving 6%

There appears to be no penalty when adding a second sprite. However, adding a second button doubles the GPU load. This explains why the problems became apparent when I duplicated a 5 button setup.

This version of GDevelop is: 5.3.198 (editor full version: 5.3.198-4bf576a889a1975c93d54b7b498f1eb5b007eebc, core version: 4.0.99-0-release)
Running on Windows 10 with an Intel Arc 750 GPU (fully updated drivers)

Do you have the scene editor open when you preview the game? If so, switch to the events tab and try previewing again.

This is all tested with the scene editor open. I’ve just tested what you suggested (changing between scene and events editor while launching the preview) and I see the same spike in GPU use when the scene editor is open and then the load drops when I swap to the events editor. The preview being open does not appear to have any impact.

It looks like the GPU load caused by the button only occurs when the scene editor is the active tab and the button is present on screen. I have now tested this on another scene with more objects, and a single button, and again the load ramps up when the button is on screen and drops when it is off screen.

Here’s a brief explanation to why, from this post:

That is not a relevant discussion as far as I can tell.

Switching to the scene editor tab should eliminate that (specific) impact.

The issue in the link you shared is for poor performance when viewing the event sheet, with a resolution of switching to the scene editor. My issue is poor performance specifically in the scene editor, with or without preview and specifically for a single object type. Apologies if I’m missing something obvious.

1 Like

I have also experienced this issue to. I have found a work around for it though, this is not a fix but it can help. instead of dragging the buttons into the scene, use the create code to create the buttons at the start. This stops the lag when editing the game and allows you to have the buttons.

I was also experiencing the same issue with buttons completely bogging down the scene editor. I was developing an interface with 15 - 20 buttons and it just became unbearable. This occurred on a MacBook Air M3 and an older Intel MacBook Pro.

My only workaround was to remove the buttons and use bitmap text with added button behaviors. Not ideal, but it worked.

As soon as I started removing the buttons from the scene and eventually deleting them, the scene editor became useable again.

I was using the buttons from the Asset Store, so it’s clearly an issue with those specifically.

I did a quick test with a different button set from the asset store and the lag has gone aways.

The issues I was getting only happened when using “Blue Button With Shadows” and “Green Button With Shadows”.

Using the “On Screen Control Button” set is working fine without any lag.

1 Like