I am spawning an actor on the server like so:
FTransform Transform{ FRotator::ZeroRotator, GetActorLocation() };
TObjectPtr<ABasePickup> SpawnedPickup = World->SpawnActorDeferred<ABasePickup>(ABasePickup::StaticClass(), Transform);
SpawnedPickup->SetCachedSkeletalMeshAsset(_WorldMesh);
UGameplayStatics::FinishSpawningActor(SpawnedPickup, Transform);
I am then setting the skeletal mesh of the pickup in its BeginPlay:
void ABasePickup::BeginPlay()
{
Super::BeginPlay();
if (IsValid(_SkeletalMeshComponent))
{
_SkeletalMeshComponent->SetSkeletalMeshAsset(_SkeletalMesh);
}
}
However, this will not work unless _SkeletalMesh is replicated.
I am wondering if it is possible to set properties on an actor on the server before it is even replicated to clients, so that they have a version of the actor that is setup exactly the same as on the server, without replicating properties or multicasting.
It would be even better if I could set the skeletal mesh component asset without caching a replicated pointer to an asset and setting it in BeginPlay().