UProperty min & max values?

What you’re looking for is UIMin/UIMax and ClampMin/ClampMax. Something like this should work:

UPROPERTY(EditAnywhere, Category = "Camera", meta = (ClampMin = "-89.0", ClampMax = "0.0", UIMin = "-89.0", UIMax = "0.0"))
float CameraMinPitch;

UIMin/Max clamps the slider and ClampMin/Max clamps the actual value

2 Likes

Is there a way to set a min and/or max value for a UProperty in a C++ class ?

UPROPERTY(EditAnywhere, Category = "Camera")
	float CameraMinPitch;

UPROPERTY(EditAnywhere, Category = "Camera")
	float CameraMaxPitch;

So the min pitch should be between -89 & 0.
Max pitch should be between 0 & 89.

FWIW…I found that just using the ClampMin/Max keys clamps both the actual value and ui slider.

A list of UPROPERTY meta specifiers can be found here:

Note that that metadata won’t prevent for this property to have out of range value, since they still standard C++ primitive types which you can not passively limit, or else property editor is only palce where this property is set. You need to write limitations on your own in the code for that via some set functions.