Grogger
(Grogger)
March 28, 2015, 5:53pm
1
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
4 Likes
Zeldhoron
(Zeldhoron)
March 28, 2015, 5:26pm
2
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.
1 Like
Dexgecko
(Dexgecko)
June 28, 2018, 7:20pm
4
A list of UPROPERTY meta specifiers can be found here:
Metadata keywords used when declaring UClasses, UFunctions, UProperties, UEnums, and UInterfaces to specify how they behave with various aspects of Unreal Engine and the editor
After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...
Reading time: 1 mins 🕑
Likes: 13 ❤
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.