How UObjectLibrary works

Hi! I’m newbee in C++ and trying to migrate from Unity3D to Unreal Engine. For creating games i need to storage data in Blueprint Classes (like ScriptingObject in Unity3D) and dynamic load them from sctipts (because i need also use them in my future plugins)

I create my UBlueprintFunctionLibrary class and named him UBlueprintDBItem and tried two advices from this and this

And in both of cases i take 0 count TArray of assets

Here is my code in first case

FReply FAssistLibModule::CollectBlueprintsButtonClicked()
{
	UE_LOG(LogTemp, Warning, TEXT("COLLECTING"));

	UClass* cls = TSubclassOf<class UBlueprintDBItem>();

	auto Library = UObjectLibrary::CreateLibrary(cls, true, true);
	Library->LoadBlueprintAssetDataFromPath(FString(TEXT("/Game/Blueprints/BlueprintDB")));

	TArray<FAssetData> Assets;
	Library->GetAssetDataList(Assets);

	UE_LOG(LogTemp, Warning, TEXT("ASSETS: %d"), Assets.Num());
	
	for (auto& Asset : Assets)
	{
		UBlueprint* bp = Cast<UBlueprint>(Asset.GetAsset());
		if (bp)
		{
			UE_LOG(LogTemp, Warning, TEXT("CONTENT: %s"), *bp->GetName());
		} 
		else {
			UE_LOG(LogTemp, Warning, TEXT("CONTENT: %s"), *Asset.GetAsset()->GetName());
		}
	}
	return FReply::Handled();
}

and seconds case

FReply FAssistLibModule::CollectBlueprintsButtonClicked()
{
        UE_LOG(LogTemp, Warning, TEXT("COLLECTING"));

	UClass* cls = TSubclassOf<class UBlueprintDBItem>();

	auto Library = UObjectLibrary::CreateLibrary(cls, true, true);
	Library->AddToRoot();
	Library->LoadBlueprintsFromPath(FString(TEXT("/Game/Blueprints/BlueprintDB")));

	TArray<UBlueprintGeneratedClass *> Assets;
	Library->GetObjects<UBlueprintGeneratedClass>(Assets);

	UE_LOG(LogTemp, Warning, TEXT("ASSETS: %d"), Assets.Num());
	
	for (auto& Asset : Assets)
	{
		UE_LOG(LogTemp, Warning, TEXT("BP: %s"), *Asset->GetName());
	}
	return FReply::Handled();
}

In both cases my console log is

LogTemp:Warning: COLLECTING
LogTemp:Warning: ASSETS: 0

My problem is i dont understand how UObjectLibrary works

Thanks for any advices

You may wish to look over this documentation on Object Libraries. You seem to be confusing Blueprints and the UBlueprintFunctionLibrary class. The UBlueprintFunctionLibrary isn’t a blueprint. It’s a type of UObject. So the code posted above would never really load any blueprints (assuming all you have is UBlueprintDBItems in that folder).

Secondly, if you’re looking for basic data storage akin to what ScriptObject was, I would look into the “Data Asset” content type. Or simply create blueprints that inherit from AInfo (a type of actor).

Data Asset
this is exactly what i want! Thanks!