How to specify an arbitrary derived class as a property, and have its properties editable in the editor?

In other words, imagine I have a UPROPERTY TSubclassOf FoodType as a property inside UFoodVendor. How can I make it such that when FoodType is set to UTaco I can change UTaco::SauceType in the editor, but if it’s set to UHotDog then I can change UHotDog::bHasMustard?

The answer is to:

  • Annotate the FoodType class with UCLASS(EditInlineNew)
  • Store the FoodType property as a pointer (or TObjectPtr), not a TSubclassOf
  • Annotate the FoodType property with UPROPERTY(Instanced)

And it works as desired.