NegInfinity/ProjectExodus

Undo doesn't work on imported Actors (from prefabs)

Closed this issue · 2 comments

Hi, I've exported a level from Unity to UE4 - all the prefab's are converted to Actors with a SceneComponent (as root) and all the prefab parts as subcomponents.. This all works great

However, I can't actually undo any changes to the actor.. For example; if I move the actor and then "undo" I get the message "Undo: Move Actors" but the actor stays in the same place..

Any ideas, or pointers on why this may be happening?

After some debugging it appears that the actors don't have "RF_Transactional" flag set on them, meaning the Undo system throws away any changes after the mouse is released.

Should anyone come across this next time; I ended up having to make an ActorActionUtility that iterated all selected objects in the level, then I ran a small bit of C++ (via C++ BP function, see below) that changed the root and root (a SceneComponent) to be RF_Transactional.

Essentially you select all the bad actors that won't undo and then run the editor function to "set" their flags correctly; then you need to "change" something (I added a cube) for the editor to see the map as changed, then save the map - it then persists and undo's work correctly.

UFUNCTION(BlueprintCallable)
	static void SetTransactionalFlag(AActor* OwnerActor)
{
	OwnerActor->SetFlags(RF_Transactional);
	OwnerActor->GetRootComponent()->SetMobility(EComponentMobility::Movable);
	OwnerActor->GetRootComponent()->SetFlags(RF_Transactional);
}