C++ 如何将UClassProperty转换为TSublcassOf<&燃气轮机;在虚幻引擎4中

C++ 如何将UClassProperty转换为TSublcassOf<&燃气轮机;在虚幻引擎4中,c++,unreal-engine4,C++,Unreal Engine4,我有struct属性迭代器,我需要处理TSubclassOf属性 我有一个名为“ItemClass”的TSubclassOf变量结构。 我设法得到了FClassProperty,但是我找不到一种方法从中得到TSubclassOf变量 这是我的代码: void UItemMaster::HandleStruct(FProperty* Property, void* StructPtr) { int64 ItemHash = 0; TSubclassOf<UItemBase&g

我有struct属性迭代器,我需要处理TSubclassOf属性

我有一个名为“ItemClass”的TSubclassOf变量结构。 我设法得到了FClassProperty,但是我找不到一种方法从中得到TSubclassOf变量

这是我的代码:

void UItemMaster::HandleStruct(FProperty* Property, void* StructPtr)
{
    int64 ItemHash = 0;
    TSubclassOf<UItemBase> ItemClass;

    FStructProperty* StructProperty = CastField<FStructProperty>(Property);
    if (StructProperty)
    {
        TFieldIterator<FProperty> PropertyIterator(StructProperty->Struct);
    
        for (PropertyIterator; PropertyIterator; ++PropertyIterator)
        {
            for (int32 ArrayIndex = 0; ArrayIndex < PropertyIterator->ArrayDim; ArrayIndex++)
            {
                void* ValuePtr = PropertyIterator->ContainerPtrToValuePtr<void>(StructPtr, ArrayIndex);

                if (PropertyIterator->GetAuthoredName() == TEXT("ItemClass"))
                {
                    if (FClassProperty* ClassProperty = CastField<FClassProperty>(*PropertyIterator))
                    {
                        GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, *ClassProperty->GetName());
                        // here i need to convert ClassProperty to TSubclassOf<>

                    }
                }
            }
        }
    }
}
void UItemMaster::HandleStruct(FProperty*Property,void*StructPtr)
{
int64 ItemHash=0;
TSubclassOf ItemClass;
fsstructProperty*StructProperty=CastField(属性);
if(StructProperty)
{
TFieldIterator PropertyIterator(StructProperty->Struct);
for(PropertyIterator;PropertyIterator;++PropertyIterator)
{
对于(int32 ArrayIndex=0;ArrayIndexArrayDim;ArrayIndex++)
{
void*ValuePtr=PropertyIterator->containerpttovalueptr(StructPtr,ArrayIndex);
如果(PropertyIterator->GetAuthoredName()==文本(“ItemClass”))
{
if(FClassProperty*ClassProperty=CastField(*PropertyIterator))
{
GEngine->AddOnScreenDebugMessage(-1,15.0f,FColor::Yellow,*ClassProperty->GetName());
//这里我需要将ClassProperty转换为TSubclassOf
}
}
}
}
}
}
我在网上搜索,但没有找到有用的东西

我还创建了一个不真实的论坛: