Download

Problem with IPropertyHandle::AsArray()

Hello.
I am trying to display custom drop down in editor. Everything is working well, but only for simple customization. I used the same pattern as in the engine to build the drop down, but I get null exception. Below is the whole function:


   void FUWECustomDropDownStructureSettings::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder)
  {
  IDetailCategoryBuilder& StructuresCategory = DetailBuilder.EditCategory("Structures", FText::FromString(TEXT("Structures")), ECategoryPriority::Important);
   
  TSharedPtr<IPropertyHandle> StructuresProperty = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(AUWStructuresSettings, StructureNames));
  TSharedRef<IPropertyHandle> StructuresPropertyRef = StructuresProperty.ToSharedRef();
  TSharedPtr <IPropertyHandleArray> StructuresPropertyArray = StructuresPropertyRef->AsArray();
  TSharedRef<FDetailArrayBuilder> StructuresArrayPropertyBuilder = MakeShareable(new FDetailArrayBuilder(StructuresPropertyRef));
  StructuresArrayPropertyBuilder->OnGenerateArrayElementWidget(FOnGenerateArrayElementWidget::CreateSP(this, &FUWECustomDropDownStructureSettings::GenerateStructureArrayElementWidget, &DetailBuilder));
  StructuresCategory.AddCustomBuilder(StructuresArrayPropertyBuilder);
  }

Null exception is in that line:



  TSharedRef<FDetailArrayBuilder> StructuresArrayPropertyBuilder = MakeShareable(new FDetailArrayBuilder(StructuresPropertyRef));  

because StructuresPropertyArray is null. What am I missing to get this working?