What I’m trying to accomplish - I’m attempting to use a custom meta data tag “Required” to tag properties where they can’t be null, and where any properties are found to be null that are tagged as required, it’ll add new FMessage and log to the console to inform the designer.
What I’ve done so far - besides adding Required=true to the meta data specifiers in the UPROPERTY specifiers, I’ve also created an interface “IMeta” with a function “ValidateRequired(UClass* Class, UObject* Object)”, which does something like this:
void IMeta::ValidateRequired(UClass* Class, UObject* Object)
{
for (TFieldIterator<FProperty> PropIt(Class); PropIt; ++PropIt)
{
if (PropIt->HasMetaData("Required"))
{
if (something here == null)
{
FMessageLog(FName("Required")).Error(FText::FromString(FString::Format(TEXT("Required property {0} on {1} is null valued. Please assign a value."), {PropIt->GetName(), Object->GetName()})));
}
}
}
}
Is there some way to find the value on the passed object based on the property that was found, and as a result find if the value is null or not?