Why is NavData not replicated to clients?

This is intentional. By default only AI is using navmesh and AI lives only on the server. Also, replicating navigation data would saturate your connection really fast. The only option would be to have static navmesh loaded on clients, but that requires changes to C++ code (meaning it’s not an exposed feature you can enable).

Cheers,

–mieszko

I tried playing Top Down template with a (listen) server and 2 clients but clients cannot move. Then i executed Show Navigation console command and clients didnt had any nav data (green area). Is this intentional or a bug?

I used a workaround like this (Big Thanks to Omberone. Check his answer here)

TopDownNetworkTestCPPlayerController.h

UFUNCTION( reliable, server, WithValidation )
void MoveToDestination( const FVector Destination );
bool MoveToDestination_Validate( const FVector Destination );
void MoveToDestination_Implementation( const FVector Destination );

TopDownNetworkTestCPPlayerController.cpp:

bool ATopDownNetworkTestCPPlayerController::MoveToDestination_Validate( const FVector Destination )
{
    return true;
}

void ATopDownNetworkTestCPPlayerController::MoveToDestination_Implementation( const FVector Destination )
{
    APawn* const Pawn = GetPawn();
    if (Pawn)
    {
        UNavigationSystem* const NavSys = UNavigationSystem::GetCurrent( this );
        if (NavSys && (FVector::Dist( Destination, Pawn->GetActorLocation() ) > MIN_CLICK_DISTANCE))
        {
            NavSys->SimpleMoveToLocation( this, Destination );
        }
    }
}

Thanks for the info MieszkoZ! :slight_smile:

So if i want to make an RTS multiplayer game, how should i proceed? I mean if NavMesh is only on server then how can clients place their buildings and move around them?

Plus what changes should i make to load static navmesh on clients?

Regarding loading navmesh on clients you should start by enabling navigation system creation on clients - look for CreateNavigationSystem and cases when it’s not being called.

Regarding new buildings and navmesh, regardless of where the navmesh is, replicating building actor creation should be enough to trigger navmesh update (provided you have navmesh set up for runtime generation).