Hello,
I have a custom C++ class named UHandsAnimInstance :
UCLASS(transient, Blueprintable, hideCategories = AnimInstance, BlueprintType)
class SENSORIALSDK_API UHandsAnimInstance : public UAnimInstance
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Fingers)
bool isRight = true;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Fingers)
FRotator wrist;
}
It has some custom properties inside and it is the parent class of an animation blueprint asset as you can see in this picture:
And it is located in this location: “/Game/SensorialXR/Blueprints/Gestures/RightHand”
My main problem is that I want to select that object from Content Manager so first I try to put that as a property in another class (AActor class):
UPROPERTY(EditAnywhere, BlueprintReadWrite)
TArray<UHandsAnimInstance*> gestureData;
But I cannot select any object in the editor selector:
So I tried to load all assets from a FString parameter that is the path of all UHandsAnimInstance at runtime using this code in the BeginPlay function inside the custom AActor class:
FString gesturesPath = "/Game/SensorialXR/Blueprints/Gestures/RightHand";
FAssetRegistryModule& AssetRegistryModule = FModuleManager::LoadModuleChecked<FAssetRegistryModule>("AssetRegistry");
TArray<FAssetData> AssetData;
AssetRegistryModule.Get().GetAssetsByPath(FName(*gesturesPath), AssetData);
for (int i = 0; i < AssetData.Num(); i++) {
UAnimBlueprint* animx = Cast<UAnimBlueprint>(AssetData[i].GetAsset());
if (animx) {
//Do Something (like add to the gestureData list)
}
}
The problem is that the class of the obtained asset is UAnimBlueprint (that is why I cast that asset to that type):
But I cannot do anything neither get the UHandsAnimInstance object from that asset:
So, what can I do to get the data I want of my custom C++ class from a blueprint object in the content manager?