What happens when unloading/activating Actors via BluePrints with DataLayers?

Hey, I am currently working on an Action Adventure, third-person game in UE 5.6 using mostly BluePrint. For my project I use DataLayers in order to un-/load Actors from/into the current level. But I have some problems right now with the DataLayer which creates conflicts I guess with my SaveGame-System (using the UE’s SaveGame-Logic). So in order to understand why these problems happen, I need to understand the DataLayer in more detail.

I have asked ChatGPT but I am not sure if it is hallucinating stuff since I couldn’t confirm what he told me.

Here are some question I have:

  • What happens when actors gets “Activated" in the level? Does the DataLayer-Mechanic of UE load a totally new instance of an actor, or is it the same actor placed in the world? Some tests I did made me come to the conclusion that a totally new instance of an actor is created.
  • What happens when actors get “Unloaded” from the level? Are they destroyed or just hidden? ChatGPT told me that unloaded actors can (but does not necessarily) get destroyed by the garbage-collector if UE decides it needs to cleanup space. Is that true?
  • What happens with the BeginPlay-Event, does ist trigger everytime the Actor gets loaded into the level? Even though it was loaded before (unload and then activate)? And is there an equivalent event/function for unladoing an actor, e.g. OnUnloadActorEvent?

I would be grateful if someone could tell me how DataLayer manage such things in the background so I can improve my SaveGame-System.

Addional Info:

So, why this topic is so important for is the following… I’ve watched some tutorial regarding the generation and usage of GUIDs for an actor (relevant for the SaveGame-System). Most of these tutorials use the “NewGUID-Function” in the constructor of the actor to generate a GUID without setting them for each actor individually.

This is fine so far. But now that I use DataLayers, it seems that the initially generated and in the World-Detailer visible GUID gets overwritten by the constructor when the DataLayer activated the actor. This is really odd to me and i cannot grasp why this happens.

loaded = spawned, unloaded = destroyed.

Work around is to have the actors simply teleport below the map when unused, moved up when needed. Sort of like obj pooling. They still exist for save game referencing.

1 Like

Actors load/unload by DataLayer toggle in UE msg.