Hello,
i want to open a .txt-Map file with a function and this function should resize and fill the array which i want to give in as blueprint.
But for some reason if i do Array.Empty() nothing happen with the Array.
Does someone know how to do this?
My Blueprint looks like this:
And the Code:
bool UFile::LoadIntegerArrayFromFile(FString LoadDirectory, FString FileName, TArray<int32> Array, int32 &Width, int32 &Height, int32 &ArraySize)
{
FString Text;
int32 TextLines;
TArray <FString> TextLine;
//Dir Exists?
if (!FPlatformFileManager::Get().GetPlatformFile().DirectoryExists(*LoadDirectory))
{
return false;
}
//get complete file path
LoadDirectory += "\\" + FileName;
//get data
if (FFileHelper::LoadFileToString(Text, *LoadDirectory))
{
TextLines = Text.ParseIntoArrayLines(&TextLine);
TextLine[0].Trim();
Width = FCString::Atoi(*TextLine[0]);
TextLine[1].Trim();
Height = FCString::Atoi(*TextLine[1]);
ArraySize = Width*Height - 1;
Array.Empty(); // <-- Nothing happen!
for (int32 i = 2; i < TextLines; i++)
{
// fill Array
}
TextLine.Empty();
return true;
}
return false;
}
Tanks Greetings