Crash spawn actor template

Hi,

I’m trying to spawn an actor taking as template another one. So after I executes the code below, there would be two objects with the same components and properties.

FActorSpawnParameters spawnParameters;
    spawnParameters.Name = *GetOwner()->GetName();
    spawnParameters.Template = GetOwner();
    spawnParameters.Owner = GetOwner();
    spawnParameters.OverrideLevel = GetOwner()->GetLevel();
    spawnParameters.Instigator = GetOwner()->GetInstigator();
   
    m_spawned = GetWorld()->SpawnActor<AStaticMeshActor>(spawnParameters);

But I has found some problems.

1.- If I uses the same name as the original object. The copy is constructed but the original is removed from the scene.
2.- If uses other name. The spawn process crashes trying to allocate the new Object.

Also I tried to duplicate the object using “DuplicateObject”. Then the object is created but I can’t see it in the scene . If I want to remove it from the scene, the engine crash because the object hasn’t a level registered. I think that the object is not initialized and also is not registered in the level.