The character disappears on the client when the host does not see it?

If I drag a character from the project, and start the game already with him, then he is always visible. But if I create a character in runtime, then such a bug occurs. Anybody can help me with it?



ABaseEntity* AEntities::Spawn(const FString& cs, const FVector& vector, ETeam_t team, UWorld* world, AActor* net_owner)
{
    const FString fullPath = "Blueprint'/Game/Units/" + cs + "." + cs + "_C'";
    const TSubclassOf<AActor> SpawnActor = Cast<UClass>(StaticLoadObject(UObject::StaticClass(), NULL, TCHAR_TO_WCHAR(*fullPath), NULL, ELoadFlags::LOAD_Verify, NULL, true));

    FActorSpawnParameters SpawnParams;
    SpawnParams.Owner = net_owner;
    SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;

    ABaseEntity* actor = world->SpawnActor<ABaseEntity>(SpawnActor, vector, FRotator::ZeroRotator, SpawnParams);

    actor->SetTeam((int)team);
    actor->TeleportTo(vector, FRotator::ZeroRotator);
    actor->RegisterComponents();
    actor->SpawnDefaultController();

    return actor;
}



Your explanation is teling me nothing.
For networking, if a Actor should be properly visible to server and Client, ist must be spawned on the server.