Runtime way to disable/enable Event Groups or prevent crash when recreating linked objects

Hi everyone,

I’m facing a persistent crash in my project related to linked objects and runtime deletion/recreation.
The crash message is:

TypeError: Cannot read properties of null (reading position)

It happens during a “reroll” action in my game (similar to a shop refresh):
I delete a set of TokenCat, TxtHP, TxtATK, TxtLVL, etc., all linked to Carta_Blanca objects through the Linked Objects extension, and then immediately recreate and re-link new ones.

What works

If I manually disable my two “over/hover” groups (which move or resize those linked texts on mouse over/out), everything works fine — no crash.
When those groups are active, the crash happens randomly (but always right after the reroll).

I tried:

  • Setting a scene variable is_refreshing = 1 during reroll and using that condition in the hover groups.
  • Adding Wait(0.1) between delete and create.
  • Checking object counts (SceneInstancesCount > 0).
  • Moving all logic into Repeat / ForEach events carefully.

But the crash persists unless I disable those two event groups manually in the editor.

The main problem

GDevelop currently has no action to enable or disable an event group at runtime, and that would actually solve this easily.
If we had actions like:

EnableEventGroup(“GroupName”)
DisableEventGroup(“GroupName”)

…we could temporarily turn off hover/update groups during reroll and turn them back on after everything is recreated.

What I suspect

It looks like some “LinkedObjects::PickObjectsLinkedTo” actions from the hover groups are still running in the same frame that the texts are being deleted, so Pixi tries to update the position of a text that no longer exists.

Basically, it’s a race condition between deletion and picking linked instances.

Question

  • Is there any current way (via action, JavaScript event, or workaround) to disable/enable event groups at runtime?
  • If not, could this be considered as a feature request? It would really help prevent crashes when refreshing dynamic UI linked to objects.

Example project snippet

I can share the JSON structure if needed — it’s a simplified reroll event that deletes all linked texts, recreates them, and links them again to 5 cards.
It works perfectly when the hover groups are disabled, so it’s definitely related to them still running while the objects are being refreshed.



Thanks in advance! :pray:
Luis

IDK if this is the issue or the only issue but I’ve been seeing this issue a lot lately.

When you delete an object, it doesn’t get deleted until the next event. So, when you delete and add an object in the same event or a subevent both objects temporarily exist.

So, when you try to create a new link, it’s actually linking the objects that are marked for deletion. I’m guessing the link function uses the oldest created object. So, it ignores any other objects.

Here’s my test events.

And the result. The original object’s Y = 200

I don’t want to call it a workaround but the way to avoid this is to place the delete and create on different events. “It’s not a bug but a feature”

Result

You can add subevents to the create object event. You just can’t put delete and then create.

I’m referring to this section.

Oops. I should’ve circled the delete actions not the unlink.

You should be able to skip a group of events if they’re a subevent of say a boolean variable condition. Maybe the variable was being changed.