Download

Client HUD elements not showing after updating Project

First off this project was started using Unreal engine 4.13.2 I know that updating engines mid project is usually a terrible idea, and learning more every day why that is, but due to the fact I’m doing this at my school and they only have versions 4.16 and 4.17 we decided to attempt the update. I completed the update a few weeks ago from 4.13 to 4.17 and thought I had everything work. This is a first person shooter multiplayer game, and again everything I’m talking about was working perfectly fine before the version update. What is happening now is we have a Widget Blueprint called WBP_Spawn which comes up at the beginning of the match for a player to select there class and weapon loadout. The section which shows the weapon loadout is the only part of that widget which isn’t being displayed for the “client” players all other buttons and aspects of that widget are working fine on the client side. The other issue I’m having is that the client isn’t changing the camera correctly when the player “spawns” into the game Bellow is screenshots of the Widget and hard code related to these issues. Any help will be appreciated. As for the last image with the SetPlayerClass function in the widget. I didn’t show the entire thing as it’s the same thing repeated multiple times for each player class.



void ABasePlayerController::EnterSpawnState()
{
    State = EPlayerStateEnum::Spawn;

    if (IsLocalController())
    {
        OnEnterSpawnState();
    }
}

void ABasePlayerController::OnEnterSpawnState()
{
    bCustomizing = false;

    OnEnterState(ASpawnHUD::StaticClass(), true);
    SetViewTargetToMenuCamera();
}

void ABaseGameMode::MovePlayerToEntryState(ABasePlayerController * PC)
{
    PC->EnterSpawnState();
}

void ABaseGameMode::PlayerSpawn(ABasePlayerController * PC)
{
    if (CanPlayerSpawn(PC))
    {
        AActor * PlayerStart = FindPlayerStart(PC);
        if (PlayerStart)
        {
            FActorSpawnParameters SpawnParams;
            SpawnParams.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AdjustIfPossibleButAlwaysSpawn;

            // Spawn based on player class
            ASoldier * Soldier = NULL; 
            switch (PC->GetClass())
            {
            case (EClassEnum::Leader):
                Soldier = GetWorld()->SpawnActor<ASoldier>(LeaderClass, PlayerStart->GetActorLocation(), FRotator(0.f, PlayerStart->GetActorRotation().Yaw, 0.f), SpawnParams);
                break;
            case(EClassEnum::Medic):
                Soldier = GetWorld()->SpawnActor<ASoldier>(MedicClass, PlayerStart->GetActorLocation(), FRotator(0.f, PlayerStart->GetActorRotation().Yaw, 0.f), SpawnParams);
                break;
            case(EClassEnum::Rifleman):
                Soldier = GetWorld()->SpawnActor<ASoldier>(RiflemanClass, PlayerStart->GetActorLocation(), FRotator(0.f, PlayerStart->GetActorRotation().Yaw, 0.f), SpawnParams);
                break;
            case(EClassEnum::Scout):
                Soldier = GetWorld()->SpawnActor<ASoldier>(ScoutClass, PlayerStart->GetActorLocation(), FRotator(0.f, PlayerStart->GetActorRotation().Yaw, 0.f), SpawnParams);
                break;
            case(EClassEnum::Grenadier):
                Soldier = GetWorld()->SpawnActor<ASoldier>(GrenadierClass, PlayerStart->GetActorLocation(), FRotator(0.f, PlayerStart->GetActorRotation().Yaw, 0.f), SpawnParams);
                break;
            case(EClassEnum::Saboteur):
                Soldier = GetWorld()->SpawnActor<ASoldier>(GrenadierClass, PlayerStart->GetActorLocation(), FRotator(0.f, PlayerStart->GetActorRotation().Yaw, 0.f), SpawnParams);
                break;
            case(EClassEnum::MachineGunner):
                Soldier = GetWorld()->SpawnActor<ASoldier>(GrenadierClass, PlayerStart->GetActorLocation(), FRotator(0.f, PlayerStart->GetActorRotation().Yaw, 0.f), SpawnParams);
                break;
            default:
                Soldier = GetWorld()->SpawnActor<ASoldier>(SoldierClass, PlayerStart->GetActorLocation(), FRotator(0.f, PlayerStart->GetActorRotation().Yaw, 0.f), SpawnParams);
                break;
            }

            // Spawn soldier
            //ASoldier * Soldier = GetWorld()->SpawnActor<ASoldier>(SoldierClass, PlayerStart->GetActorLocation(), FRotator(0.f, PlayerStart->GetActorRotation().Yaw, 0.f), SpawnParams);
            if (Soldier)
            {
                USkeletalMesh * SoldierMesh = NULL;
                ABaseWorldSettings * WorldSettings = Cast<ABaseWorldSettings>(GetWorldSettings());
                if (WorldSettings)
                {
                    const ETeamEnum PlayerTeam = PC->GetTeam();
                    const bool bTeamAMeshes = PlayerTeam == ETeamEnum::TeamA || PlayerTeam == ETeamEnum::None;
                    const TArray<USkeletalMesh *> & MeshesArray = bTeamAMeshes ? WorldSettings->TeamASoldierMeshes : WorldSettings->TeamBSoldierMeshes;
                    if (WorldSettings->bUseRandomSoldierMeshes)
                    {
                        if (MeshesArray.Num())
                            SoldierMesh = MeshesArray[FMath::RandRange(0, MeshesArray.Num() - 1)];
                    }
                    else
                    {
                        const uint8 LoadoutSlot = PC->GetLoadoutSlot();
                        if (MeshesArray.IsValidIndex(LoadoutSlot))
                            SoldierMesh = MeshesArray[LoadoutSlot];
                    }
                }

                Soldier->SetLoadout(GetPlayerLoadout(PC), SoldierMesh);
                PC->Possess(Soldier);
                PC->CheckPerks(Soldier);
                PC->EnterPlayingState();
            }
        }
    }
}