Hello,
I have UObjectLibrary in which load some data about my blueprints. Like that
ShipsLibrary = UObjectLibrary::CreateLibrary(AShip::StaticClass(), true, GIsEditor);
ShipsLibrary->AddToRoot();
int32 loaded = ShipsLibrary->LoadBlueprintAssetDataFromPath(TEXT("/Game/Ships"));
Then I get FAssetData for loaded blueprints.
TArray<FAssetData> Assets;
ShipsLibrary->GetAssetDataList(Assets);
And now i want to spawn an actor from FAssetData that I got from ShipsLibrary.
I try it that way:
auto wld = GetWorld();
auto res = wld->SpawnActorDeferred<AActor>(Assets[0].GetClass(), loc, GetActorRotation());
if (!res)
UShipUtils::TestPrintMsg(TEXT("Spawn Failed!")); //Just my test log
But i always get “Spawn Failed!”. I Also tried Assets[0].GetAsset()->StaticClass() - same result.
Is there a way to spawn Actor(blueprint) from FAssetData ?