SpawnActorDeferred not working as intended?

In one word SpawnActorDeferred is not deferring the constructor of actors.

In the constructor of AMyActor, one section of code determines which static mesh MyActor should load according to class member (say) int MeshStyle, for example

   AMyActor::AMyActor()
    {
        // Other stuff
        static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMeshAsset0(TEXT("Reference0")
    
        static ConstructorHelpers::FObjectFinder<UStaticMesh> StaticMeshAsset1(TEXT("Reference1")
       
        // I omitted checking whether they Succeeded() nor not here
        if (MeshStyle == 0)
        {
             StaticMeshComponent->SetStaticMesh(StaticMeshAsset0.Object)
        }
        else
        {
            StaticMeshComponent->SetStaticMesh(StaticMeshAsset1.Object)
        }
    
        // Other stuff

In the handler class , I have:

AMyActor* AHandler::SpawnMyActor(FTransform Transform, int MeshStyle = 0)
{
    AMyActor* MyActor = GetWorld()->SpawnActorDeferred<AMyActor>(AMyActor::StaticClass(), Transform, this, nullptr, ESpawnActorCollisionHandlingMethod::AlwaysSpawn);
    if(MyActor)
    {
        MyActor->MeshStyle = MeshStyle;
        UGameplayStatics::FinishSpawningActor(MyActor, Transform);
    }

    return MyActor;

But no matter what MeshStyle I pass into this function, I always get the static mesh corresponding to MeshStyle = 0.
I did some UE_LOG debugging and found out that MyActor::MyActor is called before FinishSpawningActor, and this is not working as advertised(SpawnActorDeferred should postpone the constructor of the Actor).

I don’t know why or what to do!

I think it’s working as intended (although tricky to understand at first).
SpawnActorDeferred: WILL NOT run Construction Script of Blueprints to give caller an opportunity to set parameters beforehand.”

It says blueprints, but you should be able to override OnConstruction in C++ to do what you want. In case of deferred spawning, OnConstruction will not run until you call FinishSpawningActor (follow UGameplayStatics::FinishSpawningActor to see what happens when it’s called).

Also see:

https://forums.unrealengine.com/development-discussion/c-gameplay-programming/12970-beginplay-vs-constructor?27461-BeginPlay-VS-Constructor=

Thanks for the clarification!
I will try to move everything in constructor to OnConstruction and see what happens.