# How to add properties to custom detail view?

**URL:** <https://forums.unrealengine.com/t/how-to-add-properties-to-custom-detail-view/1902057>\
**Category:** C++\
**Tags:** unreal-engine, editor, CPP, question\
**Created:** [June 13, 2024, 5:50pm UTC](https://forums.unrealengine.com/t/how-to-add-properties-to-custom-detail-view/1902057 "2024-06-13T17:50:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![TomHank](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tomhank/32/615012_2.png) [@TomHank](https://forums.unrealengine.com/u/TomHank)\
**Post date:** [June 13, 2024, 5:50pm UTC](https://forums.unrealengine.com/t/how-to-add-properties-to-custom-detail-view/1902057/1 "2024-06-13T17:50:53Z")

</div>

.h:

```auto
class UMySettingsObject : public UObject
{
   // GENERATED_BODY()

public:
    // 构造函数
    UMySettingsObject();

    ///**设置Actor对象 */
    UPROPERTY(EditAnywhere, Category = Settings, meta = (DisplayName = "Actor对象"))
    AActor* TestActor;
};

class FHumanSettingDetails : public IDetailCustomization
{
public:
    FHumanSettingDetails(TSharedPtr<STextBlock> InConfigCardTextBlock)
        : ConfigCardTextBlock(InConfigCardTextBlock) {}

    virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override;

    static TSharedRef<IDetailCustomization> MakeInstance(TSharedPtr<STextBlock> InConfigCardTextBlock)
    {
        return MakeShareable(new FHumanSettingDetails(InConfigCardTextBlock));
    }

private:
    void OnCharacterNameChanged(const FText& NewText);

    TWeakPtr<STextBlock> ConfigCardTextBlock;
   
    TSharedPtr<SEditableTextBox> CharacterNameTextBox;
    TSharedPtr<SComboBox<TSharedPtr<FString>>> VoiceModelTypeComboBox;
    TSharedPtr<SComboBox<TSharedPtr<FString>>> SoVITSWeightsComboBox;
    TSharedPtr<SComboBox<TSharedPtr<FString>>> GPTWeightsComboBox;
    TSharedPtr<SEditableTextBox> IPAddressTextBox;
    TSharedPtr<SEditableTextBox> PortTextBox;
    TSharedPtr<SCheckBox> NativeIPAddressCheckBox;
    TSharedPtr<SCheckBox> AutoConfigureIPCheckBox;
    TSharedPtr<SComboBox<TSharedPtr<AActor>>> ActorComboBox;

};

```

.cpp:

```auto
void FHumanSettingDetails::CustomizeDetails(IDetailLayoutBuilder& DetailBuilder)
{
	IDetailCategoryBuilder& Category = DetailBuilder.EditCategory("Settings", LOCTEXT("SettingsCategory", "设置"), ECategoryPriority::Default);

I have tried:

IDetailCategoryBuilder& Category = DetailBuilder.EditCategory("Settings", LOCTEXT("SettingsCategory", "Settings"), ECategoryPriority::Default);

// Get the Property Handle of GangBangActor properties
TSharedRef<IPropertyHandle> TestActorHandle = DetailBuilder.GetProperty(GET_MEMBER_NAME_CHECKED(UMySettingsObject, TestActor));

// Check if the Property Handle is valid
if (TestActorHandle->IsValidHandle())
{
// Add the Property Handle to the Category
Category.AddProperty(TestActorHandle);
}
else
{
// Output debug information
UE_LOG(LogTemp, Warning, TEXT("Invalid Property Handle for TestActor"));
}

}

2. Category.AddProperty(GET_MEMBER_NAME_CHECKED(UMySettingsObject, TestActor));

```

In the above two attempts, the code does not report an error, but the attribute is not added. What should I do?
