If you’re trying to limit the value of NumPages to only positive values while modifying it in the edttor, you can use the meta property ClampMin to set a minimum value.
UPROPERTY(EditAnywhere, BlueprintReadOnly, meta=(ClampMin=0))
int32 NumPages = 100;
There’s also the PostEditChangeProperty function that you can override to do operations on the value after it was edited.
#if WITH_EDITOR
void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override;
#endif
#if WITH_EDITOR
void ASomeActor::PostEditChangeProperty(struct FPropertyChangedEvent& PropertyChangedEvent)
{
Super::PostEditChangeProperty(PropertyChangedEvent);
FName PropertyName = (PropertyChangedEvent.Property != NULL) ? PropertyChangedEvent.Property->GetFName() : NAME_None;
if (PropertyName == GET_MEMBER_NAME_CHECKED(ASomeActor, NumPages))
{
if (NumPages < 0)
{
MakePositive();
}
}
}
#endif
^ modified code from: