Get blueprint variable for editor module

Hi, I try create a custom module for my project. I 've create a toolbar button and window with a button .

I wrote a function for filterCharacterButton. I tried sort my blueprints class according their integer value. My blueprint classes based on my own BaseCharacter.cpp . it has an integer value like MyInt32Variable. I created an array for this blueprints via ObjectLibrary. But couldnt acces variable value. this is my code.


auto ObjectLibrary = UObjectLibrary::CreateLibrary(UBlueprint::StaticClass(), true, true);
    ObjectLibrary->LoadAssetDataFromPath(Path);

    TArray<FAssetData> AllAsset;

    TArray<FAssetData> FilteredData;

    ObjectLibrary->GetAssetDataList(AllAsset);
    UE_LOG(LogTemp, Warning, TEXT("Found assets: %d"), AllAsset.Num());

    for (const auto& AssetData : AllAsset)
    {


        FStreamableManager AssetLoader;
        FStringAssetReference AssetRef(AssetData.ObjectPath.ToString());
        auto BP = CastChecked<UBlueprint>(AssetLoader.LoadSynchronous(AssetRef));
        static const FName MyProperty(TEXT("MyInt32Variable"));
        static const FName MyFloatProperty(TEXT("MyFloat"));

        if (BP->ParentClass->IsChildOf(ABaseClass::StaticClass())) {
            UE_LOG(LogTemp, Warning, TEXT("BPClass"));
            ABaseCharacter* obj = Cast<ABaseCharacter>(BP);
            if (obj){
                UE_LOG(LogTemp, Warning, TEXT("value: %i"), (obj->MyInt32Variable));

            }
        }
    }

and output


LogTemp: Warning: Found assets: 5
LogTemp: Warning: BPClass
LogTemp: Warning: BPClass
LogTemp: Warning: BPClass
LogTemp: Warning: BPClass
LogTemp: Warning: BPClass

I tried use BP->NewVariables] also. I can access variables name but cant access value.

Is there anyway to access variable values?

You cannot cast UBlueprint to ACharacter object.
You have to Cast BP -> GeneratedClass -> DefaultObject.

You saved me. Thanks for help.