NewObject is not seen when I compile

Good morning everyone
When I run it in the editor everything looks correct as it should, but when I compile the project I don’t see the meshes that are created with NewObject.
The code is fine, I think, but I’m sure I’m missing something and I don’t know what it is.
The creation code is as follows

    chapitelComponent = NewObject<UStaticMeshComponent>(this, UStaticMeshComponent::StaticClass());
    chapitelComponent->SetRelativeLocation(FVector(X, Y, 520));
    chapitelComponent->SetRelativeRotation(FRotator(0, CCAngle, 0));
    chapitelComponent->CreationMethod = EComponentCreationMethod::UserConstructionScript;

The definition in the .h is:

     UStaticMeshComponent* chapitelComponent;

If anyone can help me I would be eternally grateful. I’ve been stuck with this for two days.

Solved !!
Two days for the blessed UPROPERTY.
In the .h you have to define the variable with:

    TArray<UStaticMeshComponent*> chapitelComponent;