How to properly setup child/parent relationship in editor via functions ?

I’m quite new to Unreal and have trouble with the child/parent definition.

What I’m trying to do :

  • I have a parent actor, its purpose is to hold the utility functions I need and to be a parent of new actors.

  • This parent actor has a function that is callable in editor. This function uses the SpawnActor node to create some new actors from a given BP.

  • This function also sets the spawned actors to bet children of the parent actor via Attach Actor to Actor.

The problem that I have is, when I call the function in editor, everything works fine, the children are correctly bound to the parent but as long as I save the project, they no longer are children of the parent actor.

Before save :

After save :

Note that they no longer have any parent, they go back to the root of my level.

I have tried many things, in particular trying to modify the parent (as it doesn’t appear in the unsaved actors). I have also tried to set the children as children of a scene in the parent actor via Attach Actor to Component. I have also tried to modify the parent actor to be a Editor Utility Blueprint but it didn’t change anything (this is the version shown on the screenshots).

Do you have any idea of what is happening ? Is this a correct way to setup this kind of child/parent relationship or should I use another method ?

I would like to understand what’s going wrong rrather than just a dirty fix, as I would like to use this kind of relationships for other actors in my game.

Thank you for your help,

I wonder if you have a construction script or another script that resets the parent of those child actors? Could you share a screenshot of your Blueprint? It would be easier to identify the issue.

The construction scripts of both actors are empty.

Here is the function that I call to spawn the children :

Basically it’s two for loops for the two axis of the grid, I call SpawnActor at a given location. Then I store the children in an array. The, after the for loop, I iterate over the array to attach all the spawned actors.

Once again, everything works fine until I save my project. Also if I save by quitting the project, it seems to be saved properly.