Quantcast
Channel: General - Epic Developer Community Forums
Viewing all articles
Browse latest Browse all 9767

[Feature-Request] Ability to validate UObject with meta specifiers

$
0
0

It would be nice to have some sort of explicit data validation in Blueprint and C++. Helpful in situation, where you don’t have to rely on assertions in C++ code.

This system would work similar to meta = (BindWidget) tag specifier. Where the Blueprint script won’t compile successfully, unless the widget exists.

And to specify how the validation works, either by adding a meta tag directly to it:

UPROPERTY(meta = (NotNull))
UCurveFloat* CurvePtr;
UPROPERTY(meta = (NotNull))
TSoftClassPtr<AActor> SoftActorClassPtr;

Or by redirecting a specific function to it:

UPROPERTY(meta = (Validate="CheckCurve"))
UCurveFloat* CurvePtr;

UFUNCTION()
bool CheckCurve()
{
    return CurvePtr != nullptr;
}

It would be also nice, to specific the severity of the validation. For an example:

UPROPERTY(meta = (NotNull, TreatValidationAsError=true))
UCurveFloat* CurvePtr;

And this would result of Blueprint not compiling before assign a valid curve to it.

But if we would disable it, then Blueprint will just give us a warning. And compile successfully. The default value would be true.

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 9767

Trending Articles