Custom Kismet Compiler to Generate Runtime Data from Editor Data

I could not find any example or information regarding my issue at hand. Here is my ‘‘use case’’.

  • I have a Blueprint Class X_BP
    deriving from a native class X.

  • X_BP does not define any new member
    variable, function or anything.

  • X_BP gets data assigned (kind of a
    ‘‘database’’).

Data assigned into X_BP needs to be ‘‘compiled’’ into another format which is will be use at Runtime(GameTime) in a another member variable declared in X.

X defines TArray<UDataAsset*> Ingredients; (UProperty)
 X defines TArray<MyStruct> OrganizedIngredients; (UProperty)

Currently I have a button due to a DetailCustomization which do it, but I’d prefer do it at BP Compilation time since data (BP class) assigned in X_BP can be changed outside of the database (not edit inline). It would also allow us to have a validation pass when opening the BP instead of a manual input from the Designer.

I have defined my own Compiler has a subclass of FKismetCompilerContext, it’s linked and called properly.

In my compiler’s FinishCompilingClass() override, I’d like to do my logic to compile the Ingredients TArray into my OrganizedIngredients TArray and validate the result (log warning, error, success with messagelog’s of my compiler).

I have tried to used FScriptArray_InContainer and the CDO of my BlueprintGeneratedClass, but I’m kind of stuck at own I should be “interpreting” an Array of uint8 to my object type?

  1. How should I do this considering i have no UObject to work with, only a UClass? UBlueprintClass, GeneratedClass?
  2. Should I do it before calling Super::FinishCompilingClass()?
  3. Am I approaching my issue properly or is there a better way?

Thank you for your help!