SOLVED: UClass spawnactor crashes game when testing outside of the editor

Solved by setting the UClass SelectedCharacter variable as a UPROPERTY, thanks to TheJamsh

Ive been working on a simple character selector that carries over from the client into multiplayer. Last night i had issues that caused me to completely remove all the code related to it and rewrite it this morning (about 15 minutes ago). Heres how I have it setup now and the issue im having:

Upon the client loading the game, a default character was selected automatically and its UClass is stored in the clients gameinstance. This UClass should be valid as it was passed into the c++ function via blueprint (shown in screenshot below) (the gamemode is in blueprint as it was only created as a means of showing a HUD). This function runs and checks if the UClass is valid, if it is then it stores it in the game instance. At the main menu, the client presses a button “Host Game” to create a game (simple server travel for testing) and gets sent to the lobby map. In the lobby, the host can click Play which server travels to the game map (nonseamless for testing in the editor). In the games gamemode inside HandleStartingNewPlayer_Implementation, i cast the passed in PlayerController to my custom PlayerController, then i call a Client RPC on my custom player controller, and passes in the NewPlayer PlayerController from HandleStartingNewPlayer_Implementation. That Client RPC gets the UClass(the character) from the gameinstance, then sends the passed in PlayerController and the UCLass to a Server RPC that is also on the player controller. This Server RPC checks if the passed in UClass is valid, if it is then it spawns the actor in the world and has the passed in PlayerController possess it. This worked in the editor just fine while testing (this is why im not using seamless travel right now), but when i test outside of the editor (such as right clicking on the UE4 Project and clicking Launch Game), it crashes whenever it tries to spawn the UClass. I have been stuck at trying to get it to spawn the UClass for quite awhile and I cannot figure out why. Ill show some code from what was discussed above.

the game gamemode


void ATheHouseGameMode::HandleStartingNewPlayer_Implementation(APlayerController* NewPlayer)
{
    Super::HandleStartingNewPlayer_Implementation(NewPlayer);
    UE_LOG(LogTemp, Warning, TEXT("Handle Starting New Player"));

    if (ATheHousePlayerController * PController = Cast<ATheHousePlayerController>(NewPlayer))
    {
        UE_LOG(LogTemp, Warning, TEXT("CASTED PLAYER CONTROLLER"));
        PController->Client_GetClientCharacter(NewPlayer);
    }
}

the playercontroller


void ATheHousePlayerController::Client_GetClientCharacter_Implementation(APlayerController* PController)
{
    if (UGameInstance * GI = GetGameInstance())
    {
        if (UTheHouseGameInstance * GameInstance = Cast<UTheHouseGameInstance>(GI))
        {
            if (UClass * SelectedCharacter = GameInstance->GetSelectedCharacter())
            {
                UE_LOG(LogTemp, Warning, TEXT("SENDING CHARACTER TO SERVER FOR SPAWNING"));
                Server_SetupClientCharacter(PController, SelectedCharacter);
            }
        }
    }
}

bool ATheHousePlayerController::Server_SetupClientCharacter_Validate(APlayerController* PController, UClass* CharacterToSpawn)
{
    return true;
}

void ATheHousePlayerController::Server_SetupClientCharacter_Implementation(APlayerController* PController, UClass* CharacterToSpawn)
{
    if (CharacterToSpawn)
    {
        UE_LOG(LogTemp, Warning, TEXT("SENDING CHARACTER TO SERVER FOR SPAWNING"));
        FVector Location = FVector(-400.0f, 50.0f, 300.0f);
        FRotator Rotation = FRotator::ZeroRotator;
        FActorSpawnParameters Params;

        if (ACharacterBase * SpawnedCharacter = GetWorld()->SpawnActor<ACharacterBase>(CharacterToSpawn, Location, Rotation, Params))//crashes here always when outside the editor
        {
            PController->Possess(SpawnedCharacter);
        }
    }
}