# \[UE5.4\] \[PropertyEditor\] How to get property handle from IDetailLayoutBuilder?

**URL:** <https://forums.unrealengine.com/t/ue5-4-propertyeditor-how-to-get-property-handle-from-idetaillayoutbuilder/2176997>\
**Category:** Programming & Scripting\
**Tags:** property, UProperty, property-customizati, unreal-engine, editor, CPP, question\
**Created:** [December 6, 2024, 3:56pm UTC](https://forums.unrealengine.com/t/ue5-4-propertyeditor-how-to-get-property-handle-from-idetaillayoutbuilder/2176997 "2024-12-06T15:56:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jeangby](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jeangby](https://forums.unrealengine.com/u/Jeangby)\
**Post date:** [December 6, 2024, 3:56pm UTC](https://forums.unrealengine.com/t/ue5-4-propertyeditor-how-to-get-property-handle-from-idetaillayoutbuilder/2176997/1 "2024-12-06T15:56:01Z")

</div>

I am trying to customize the detail view of the UObject with `IDetailCustomization`.

Here is the code

```cpp
UCLASS()
class DETAILVIEW_TEST_API UMyDataAsset : public UDataAsset
{
	GENERATED_BODY()
public:
	UPROPERTY()
	int Num1;

	UPROPERTY(meta = (ClampMin = "0", ClampMax = "100"))
	int Num2;
};

/**
* Customize the details view for UMyDataAsset
*/
class DETAILVIEW_TEST_API FMyDataAssetDetails : public IDetailCustomization {
public:
	void CustomizeDetails(IDetailLayoutBuilder& builder) override {
		IDetailCategoryBuilder& Setting = builder.EditCategory("Setting");
		
		// If setup properly, there will be a new row in details view. 
		Setting.AddCustomRow(FText::FromString("Test"))
		.NameContent()
		[
			SNew(STextBlock)
			.Text(FText::FromString("Test"))
			.Font(builder.GetDetailFont())
		];

		// Try to get property and show it
		TSharedPtr<IPropertyHandle> Num1_Handle = builder.GetProperty(GET_MEMBER_NAME_CHECKED(UMyDataAsset, Num1));
		if (Num1_Handle->IsValidHandle())
			Setting.AddProperty(Num1_Handle);
		else
			UE_LOG(LogTemp, Warning, TEXT("Cannot find property Num1"));

		TSharedPtr<IPropertyHandle> Num2_Handle = builder.GetProperty(GET_MEMBER_NAME_CHECKED(UMyDataAsset, Num2));
		if (Num2_Handle->IsValidHandle())
			Setting.AddProperty(Num2_Handle);
		else
			UE_LOG(LogTemp, Warning, TEXT("Cannot find property Num2"));
	}

	static TSharedRef<IDetailCustomization> CreateInstance() {
		return MakeShared<FMyDataAssetDetails>();
	}
};

```

I also register `FMyDataAssetDetails`, when the module start up.

```cpp
void MyGameModule::StartupModule()
{
	FPropertyEditorModule& M = FModuleManager::Get().LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");

	M.RegisterCustomClassLayout(UMyDataAsset::StaticClass()->GetFName(),
		FOnGetDetailCustomizationInstance::CreateStatic( FMyDataAssetDetails::CreateInstance ));
}

void MyGameModule::ShutdownModule()
{
	FPropertyEditorModule& M = FModuleManager::Get().LoadModuleChecked<FPropertyEditorModule>("PropertyEditor");

	M.UnregisterCustomClassLayout(UMyDataAsset::StaticClass()->GetFName());
}

```

The result:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/1/c/61c403d88e5748b1f3218b808a6bf2c1888ec415.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/8/1/78135efc518eaca7d768ec84712fafc2024b1f32.png)

This is not what I am expecting. `FMyDataAssetDetails ::CustomizeDetails` is called, but I cannot get property handle from `IDetailLayoutBuilder`.

Does anyone know how to solve it?

---

<div class="post-metadata">

**Author:** ![Jeangby](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Jeangby](https://forums.unrealengine.com/u/Jeangby)\
**Post date:** [December 7, 2024, 7:43am UTC](https://forums.unrealengine.com/t/ue5-4-propertyeditor-how-to-get-property-handle-from-idetaillayoutbuilder/2176997/2 "2024-12-07T07:43:12Z")

</div>

After a few hours of try, I finally know what’s going wrong.

It seems that `IDetailLayoutBuilder::GetProperty` can only get the property handle of the property that will be shown in Detail View by default.

Therefore, `EditAnywhere`, `VisibleAnywhere`, or something like that should appear inside `UPROPERTY()`.

After revision:

```cpp
UCLASS()
class DETAILVIEW_TEST_API UMyDataAsset : public UDataAsset
{
	GENERATED_BODY()
public:
	UPROPERTY(EditAnywhere)
	int Num1;

	UPROPERTY(EditAnywhere, meta = (ClampMin = "0", ClampMax = "100"))
	int Num2;
};

```

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [January 6, 2025, 7:44am UTC](https://forums.unrealengine.com/t/ue5-4-propertyeditor-how-to-get-property-handle-from-idetaillayoutbuilder/2176997/3 "2025-01-06T07:44:10Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
