This subject seems to have gotten a little murky since Construct Object was depreciated.
What is the correct way to use New Object to spawn a new instance of a UClass? I’m trying to build a custom factory for dynamically creating actor components at run time.
Library.h
UFUNCTION(BlueprintCallable, Category="WhyUNoSpawnOutsideActor")
static void SpawnActorComponentFromClass(UClass *actorComponent, class AActor *Owner);
Library.cpp
void UApolloLibrary::SpawnActorComponentFromClass(UClass *actorComponent, class AActor *Owner)
{
NewObject(Owner, actorComponent);
//Owner->AddOwnedComponent(SpawnedComponent);
}