Hello, so im using a object library to load assets from disk.
TArray<UObject*> USpriterBlueprintFunctionLibrary::LoadObjectsFromPath(const FString& Path, TSubclassOf<UObject> ObjectClass, TArray<FString> ObjectNames)
{
UObjectLibrary* ObjectLibrary = UObjectLibrary::CreateLibrary(*ObjectClass, false, GIsEditor);
if (ObjectLibrary != nullptr)
{
ObjectLibrary->AddToRoot();
FString NewPath = TEXT("/Game") / Path;
int32 NumOfAssetDatas = ObjectLibrary->LoadAssetDataFromPath(NewPath);
if (NumOfAssetDatas > 0)
{
TArray<FAssetData> AssetDatas;
ObjectLibrary->GetAssetDataList(AssetDatas);
TArray<UObject*> Assets;
UObject* Asset;
GEngine->AddOnScreenDebugMessage(-1, 1.0f, FColor::Cyan, TEXT("Found assets, attempting to load!"));
if (ObjectNames.Num() > 0)
{
for (int32 i = 0; i < AssetDatas.Num(); ++i)
{
FAssetData& AssetData = AssetDatas[i];
const FString FoundNameString = AssetData.AssetName.ToString();
if (!FoundNameString.IsEmpty() && ObjectNames.Contains<FString>(FoundNameString))
{
Asset = AssetData.GetAsset();
if (Asset)
{
Assets.Add(AssetData.GetAsset());
}
}
}
return Assets;
}
}
}
GEngine->AddOnScreenDebugMessage(-1, 1.0f, FColor::Cyan, TEXT("Can't find assets at path!"));
return TArray<UObject*>();
}
This is the code for the function that is called to load the assets.
This function works without a problem when trying to load AnimSequence’s, but when i try to load Paper Sprite’s im given this error before the crash.
Fatal error: [File:C:\Users\Jacob\Desktop\UnrealEngine4Source\UnrealEngine\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 1969]
Object Class None created in SpriterSkeleton_C instead of Package // NOTE: SpriterSkeleton_C is the class that is calling this function