Yaaaas! So I solved it!!! Using:
#1:
bNetStartup = true
2# Use of IsNetRelevantFor
bool ABase::IsNetRelevantFor(const AActor* RealViewer, const AActor* ViewTarget, const FVector& SrcLocation) const
{
// Attempt to get the PlayerController
const APlayerController* PlayerController = nullptr;
if (const APawn* Pawn = Cast<APawn>(RealViewer))
{
PlayerController = Cast<APlayerController>(Pawn->GetController());
}
else
{
PlayerController = Cast<APlayerController>(RealViewer);
}
// Ensure we have a valid PlayerController
if (PlayerController)
{
// Cast to custom player controller
const AMyPlayerController* MyPC = Cast<AMyPlayerController>(PlayerController);
if (MyPC && MyPC->bClientReady)
{
// Client is ready, use normal relevance logic
return Super::IsNetRelevantFor(RealViewer, ViewTarget, SrcLocation);
}
else
{
// Client is not ready, actor is not relevant
return false;
}
}
// If we couldn't get a PlayerController, assume client is not ready
return false;
}
3# Spawning it with the correct name and naming it at the point of spawning it:
// Set up spawn parameters
FActorSpawnParameters SpawnParams;
SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
SpawnParams.Name = FName(*FString::Printf(TEXT("Base_0")));
// Spawn the ABase actor
Base = GetWorld()->SpawnActor<ABase>(ABase::StaticClass(), FVector(0.f, 0.f, 142013.f), FRotator::ZeroRotator, SpawnParams);
4# Manually controlling relevancy only once the object is spawned:
// Trigger the player controller to notify the server that the client is ready
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
if (PlayerController)
{
AMyPlayerController* MyPC = Cast<AMyPlayerController>(PlayerController);
if (MyPC)
{
// Notify the server that the client is ready
MyPC->ClientSignalReady();
}
}
Thanks for your help @Chatouille - Mr. Tickles! <3
THIS DOES NOT ACTUALLY WORK IF YOU PLAN TO DELETE THE ACTOR - IT WILL CREATE ISSUES WITH NETGUID (I THINK) AND CAUSE THE REPLICATION SYSTEM TO NOT WORK CORRECTLY