Validation/plausibility checks for blueprint properties

Hi Epic,

As i understand it, the editor can not validate class default property values in blueprints (except None and clamp).

Take for example a complex calculation function where the different values only make sense if they are in a certain range relative to other values.
Or Enums with a ‘invalid’ default value to force people to set it to the desired value.
Or Instanced object properties, where a unset property would result in an error (properly catched and handled in game, but only visible in logs after hitting play)

The first example could be done with a property editor customization, i know.
But for the other 2 i see no way to check for plausibility inside the editor, since a untouched property wouldn’t raise any events.
Only at runtime, which would be a bit late since not everyone wants to/does hit play everytime after a change is made.

A overridable virtual validate function, called right after CompileBlueprintInner or by PostCompile in KismetCompilerModule (it might even be possible to implement this as a BP function in a seperate graph) could solve this.

Impact on packaged game should be zero, since the validation function would not have to be packaged at all. It should be possible to package them with the validation function regarding to modding though.

I like designers/modders to go their own ways as much as possible, but some things need to be enforced. Creates a better workflow to see common errors/mistakes as soon as possible.

AnimGraphNode_WheelHandler for example has a ValidateAnimNodePostCompile function (called by PostCompile) to tell to reparent class if it is not a child of UVehicleAnimInstance.
BTW: Just seen, there is a spelling error in the message (VehicleAnimInstancen) in line 50.

I would like to hear your thoughts on this.

  • Algorithman

+1.

With how central blueprint property editing/overriding is to the UE4 workflow, I think validation options are really lacking.

I actually did this in something I was working on, but that used a custom blueprint type/blueprint compiler. Adding the functionality at a level that could be hooked into from any blueprint would be great.

It’s not completely clear what the best approach would be. If it’s validation at the compilation stage, then it obviously doesn’t apply to native classes, and yet the methods would need to be added at the UObject level. It’s not ideal, but like you say, if made EditorOnly, there would be no runtime overhead at least.

There’s also sometimes a need for instance-level validation. So a second method called during a map check would probably be good too.