Created a PR for this:
My particular application is to scan a folder for all Blueprints, which contains all the "equipment" that can be added during customization in-game.
This prevents me from creating a lookup table, or manually adding in what I hope to be hundreds of parts.
Code:
Header :
Cpp
My particular application is to scan a folder for all Blueprints, which contains all the "equipment" that can be added during customization in-game.
This prevents me from creating a lookup table, or manually adding in what I hope to be hundreds of parts.
Code:
Header :
Code:
/** * Get UClass from assets found with AssetManager (Purple Class node) * Use this to get Assets by Path, Class Type ect. * Use GET ASSET REGISTRY node -> GET ASSETS node -> as your input to this * Using correct class checking and casting, this can be used for spawning actors, getting class defaults, using textures, sounds ect. * COOKED BUILDS: : Make sure your assets/folders are manually added to cooked build if they are not used directly in Editor. * On-the-fly asset list creation or add DLC content, no lookup tables! */ UFUNCTION(BlueprintCallable, Category = "Victory BP Library|Misc") static TArray<UClass*> GetClassFromAssetData(UPARAM(ref) TArray<FAssetData>& InAssetData);
Code:
// Get UClass from asset in AssetRegistry TArray<UClass*> UVictoryBPFunctionLibrary::GetClassFromAssetData(TArray<FAssetData>& InAssetData) { TArray<UClass*> ClassArrayOut; ClassArrayOut.Empty(); // Iterate over retrieved blueprint assets for (FAssetData asset : InAssetData) { FString ObjPath = asset.ObjectPath.ToString().Append("_C"); UE_LOG(LogTemp, Warning, TEXT("Object path is : %s"), *ObjPath); UE_LOG(LogTemp, Warning, TEXT("Trying to return BPClass!")); //Get UClass ClassArrayOut.Add(StaticLoadClass(UObject::StaticClass(), NULL, *ObjPath, NULL, LOAD_None, NULL)); } return ClassArrayOut; }
Comment