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:
UCLASS()
class DETAILVIEW_TEST_API UMyDataAsset : public UDataAsset
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere)
int Num1;
UPROPERTY(EditAnywhere, meta = (ClampMin = "0", ClampMax = "100"))
int Num2;
};