Slow Compile Fix Breaks 'Words'

When I implemented the solution for slow compile times as stated in I cannot use “Words” in my GetValidWords function.

Since it is not declared in a separate header file, it does not have scope in the GetValidWords function, and I cannot use it.

I have tried putting the solution code into a header file by itself, but that didn’t work. I have also tried putting the solution code into the GetValidWords function, but it didn’t work.

Please help. I’m really stuck.

Here’s some code snippets:
GetValidWords function

TArray<FString> UBullCowCartridge::GetValidWords(TArray<FString> WordList) const
    TArray<FString> ValidWords;

    for (int32 Index = 0; Index < WordList.Num(); Index++)
        if (Words[Index].Len() >= 4 && Words[Index].Len() <=8)
    return ValidWords;


#include "FIleHelper.h"
#include "Paths.h"

void UBullCowCartridge::BeginPlay() // When the game starts
    TArray<FString> WordsList;
    const FString WordsListPath = FPaths::ProjectContentDir() / TEXT("HiddenWordList.txt");
    FFileHelper::LoadFileToStringArray(WordsList, *WordsListPath);


    PrintLine(TEXT("The Hidden Word is %s."), *HiddenWord); // Debug Line    

Solution found: Watch until the end of the lecture. Lol. All the occurrences of “Words” should be “WordList”.

Ugh, some things are too easy to find. :grin:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.