Object library in Blueprints or from c++

I ended up coding my own blueprint node in c++ for this. For future reference, this is how I solved it:

CBlueprints.h file

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"
#include "CBluePrints.generated.h"

/**
 * 
 */
UCLASS()
class TESTPROJECT_API UCBluePrints : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
public:
		UFUNCTION(BlueprintCallable, Category = "CBluePrintLibrary")
		static TArray<UObject*>  LoadObjectLibrary(const FString& Path, TSubclassOf<UObject> ObjectClass);
	
};

The CBlueprints.cpp file

// Fill out your copyright notice in the Description page of Project Settings.


#include "CBluePrints.h"
#include "Engine.h"


TArray<UObject*> UCBluePrints::LoadObjectLibrary(const FString& Path,  TSubclassOf<UObject> ObjectClass)
{
	TArray<UObject*> Assets;

	UObjectLibrary* ObjectLibrary = UObjectLibrary::CreateLibrary(ObjectClass, false, GIsEditor);
	if (ObjectLibrary != nullptr)
	{
		ObjectLibrary->AddToRoot();
		FString NewPath = TEXT("/Game") / Path;
		int32 NumOfAssetDatas = ObjectLibrary->LoadAssetDataFromPath(NewPath);
		TArray<FAssetData> AssetDatas;
		ObjectLibrary->GetAssetDataList(AssetDatas);

	
		UObject* Asset;

		for (int32 i = 0; i < AssetDatas.Num(); ++i)
		{
			FAssetData& AssetData = AssetDatas[i];
			Asset = AssetData.GetAsset();
			if (Asset)
			{
				Assets.Add(AssetData.GetAsset());
			}
		}
	}
	return Assets;
}