How to move an actor to specific Outliner folder?

Is it possible via blueprints? I saw a similar question HERE, but it’s in C++ section.

Briefly looking through the Unreal 4.13 source, I don’t see any BP-exposed code that calls SetFolderPath.

You can look more in-depth on github.

If you built C++, you could expose this functionality like so:

UCLASS()
class MYGAME_API UEditorFunctions : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:

	/**
	 * Assigns a new folder to this actor. Actor folder paths are only
	 * available in development builds.
	 * @param	NewFolderPath		The new folder to assign to the actor.
	 */
	UFUNCTION(BlueprintCallable, Category = "Actor| Editor")
	static void Editor_MoveActorToOutlinerFolder(AActor* Target, const FName& NewFolderPath);
};

void UEditorFunctions::Editor_MoveActorToOutlinerFolder(AActor* Target, const FString& NewFolderPath)
{
	if (Target != nullptr)
	{
#if WITH_EDITOR
		Target->SetFolderPath(NewFolderPath);
#endif
	}
}

I’m not sure how to share C++ extensions with BP projects (maybe a plugin with a pre-built dll?), so can help more than that!

In the Actor.h file, the SetFolderPath function is BP callable since 4.9.0, but you probably need to be in some kind of editor blueprint.

In UE5 (and probably since 4.26 at least), that function is callable from any Editor Utility Blueprints at least.

1 Like