Hi, I have a problem. I’m trying to spawn an actor from a widget for preview inside the widget. If I do it with the Spawn Actor From Class node, everything is created perfectly. But in C++ there are problems: when I try to call spawn, the console says that the actor is created, but in fact there is nothing in the outliner. I can’t understand where it is being created. I’m a big beginner in C++, so it’s kind of like that. I read that you need to disable replication; in this situation it’s indeed not needed, but that still didn’t help.
I am using Play As Client and Play As Listen Server.
Here it is in text form:
APlayerController* PlayerController = GetOwningPlayer();
FActorSpawnParameters SpawnInfo;
SpawnInfo.Owner = PlayerController;
SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
SpawnInfo.bDeferConstruction = false;
if (PlayerController->IsLocalPlayerController())
{
PreviewActor = GetOwningPlayerPawn()->GetWorld()->SpawnActor(
APreviewItemActor::StaticClass(),
FTransform::Identity,
SpawnInfo
);
PreviewActor->SetReplicates(false);
}

