Blueprint compile turns RF_Transient actors into RF_Transactional ones

Context: Procedurally spawned sub-actors that should not be persisted.

I have a custom Actor set up in C++ that spawns and attaches child actors to represent some of it’s generated content. These actors are temporary and shouldn’t be persisted, hence they are given the RF_Transient object flag.
If these child actors are blueprint based ones, recompiling the blueprint causes all the child actors to be replaced (as expected), but their ObjectFlags change from RF_Transient to RF_Transactional. This causes problems as they aren’t intended to be persisted with the level/scene.

It looks like ReplaceActorHelper used indirectly by CompileBlueprint doesn’t propagate the object flags across to the replacement actor.

I haven’t tried this for non-child actors as they are naturally a persistent part of the scene in my case.

Hmm, I should probably have filed this under “Bugs”

My current workaround is to use a persistent property to mark procedurally placed entities (my custom actor) as proc-gen placed and use this to validate and restore the transient flag in an AActor::OnConstruction override.

	//verify transient status
	if(bWasProcedurallyPlaced)
	{
		if(HasAnyFlags( RF_Transactional ) || !HasAllFlags( RF_Transient | RF_DuplicateTransient ))
		{
			//has lost it's transient status, force back		
			UE_LOG( LogXXX, Warning, TEXT( "Restoring transient status of entity that has lost it: %s" ), *GetName() );
			ClearFlags( RF_Transactional );
			SetFlags( RF_Transient | RF_DuplicateTransient );
		}
	}