How to do it...
Let's say we are trying to construct an object of a UAction type that itself derives from UObject—for example, the following class:
UCLASS(BlueprintType, Blueprintable,
meta=(ShortTooltip="Base class for any Action type") )
class CHAPTER_03_API UAction : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Properties)
FString Text;
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Properties)
FKey ShortcutKey;
};
To construct an instance of the UAction class, we'd do the following:
// Create an object
UAction * action = NewObject<UAction>(GetTransientPackage(),
UAction::StaticClass()
/* RF_* flags */ );