Download

problems reading config file

I am trying to use this as a map rotation, but then it says there are 0 elements in the array. Do Structures not allow TArrays in them?
DefaultGameTypeInfos works fine. Can read anything from it from the config file.
RacingRotation can not read from config file. always says num() is 0.

in .h file code



both structs are above class in .h file code
USTRUCT()
struct FMapPrefixes
{
    GENERATED_USTRUCT_BODY()

   UPROPERTY()
   FString Prefix;

    UPROPERTY()
    FString GameType;
};

USTRUCT()
struct FAllRotation
{
    GENERATED_USTRUCT_BODY()

    UPROPERTY()
    TArray<FString> MapSettings;
};

//these are in the class section of .h file 
//this does not read from config
UPROPERTY(Globalconfig)
struct FAllRotation RacingRotation;

//this reads fine from config
UPROPERTY(Globalconfig)
TArray<struct FMapPrefixes> DefaultGameTypeInfos;


.cpp file



FString AFastLineGameMode::GetRaceRotation()
{
    UE_LOG(LogGameType, Log, TEXT("AFastLineGameMode::GetRaceRotation() RacingRotation.MapSettings.Num() is %d"),        RacingRotation.MapSettings.Num());
    UE_LOG(LogGameType, Log, TEXT("AFastLineGameMode::GetRaceRotation() MapRotationIndex is %d"), MapRotationIndex);
    FString ChosenMap = RacingRotation.MapSettings[MapRotationIndex];
    UE_LOG(LogGameType, Log, TEXT("AFastLineGameMode::GetRaceRotation() ChosenMap is %s"), *ChosenMap);
    return ChosenMap;
}//returns nothing

//gets nothing
UE_LOG(LogGameType, Log, TEXT("AFastLineGameMode::DedicatedMapRotation() RaceRotation.MapSettings.Num() is %d"), RacingRotation.MapSettings.Num());//always returns a 0
FString AFastLineGameMode::DedicatedMapRotation()
{
   TArray <FString> ChosenChunks;
    UE_LOG(LogGameType, Log, TEXT("AFastLineGameMode::DedicatedMapRotation() has started up"));
    UE_LOG(LogGameType, Log, TEXT("AFastLineGameMode::DedicatedMapRotation() RacingRotation.MapSettings.Num() is %d"),     RacingRotation.MapSettings.Num());
    UE_LOG(LogGameType, Log, TEXT("AFastLineGameMode::DedicatedMapRotation() MapRotationIndex is %d"), MapRotationIndex);
    //which map your choosing from the map rotation and its settings
    FString ChosenMap = GetRaceRotation();
    UE_LOG(LogGameType, Log, TEXT("AFastLineGameMode::DedicatedMapRotation() ChosenMap is %s"), *ChosenMap);
     if (!ChosenMap)//this takes over and gets used rest runs fine
     {
         FString ChosenMap = "map=WashBoard gametype=NATS month=jun time=noon";
         UE_LOG(LogGameType, Log, TEXT("AFastLineGameMode::DedicatedMapRotation() ChosenMap is %s"), *ChosenMap);
      }
//The array of strings made
     ChosenMap.ParseIntoArray(ChosenChunks, TEXT(" "), true);
UE_LOG(LogGameType, Log, TEXT("AFastLineGameMode::DedicatedMapRotation() ChosenChunks.Num() is %d"), ChosenChunks.Num());

}


config file



MapRotationIndex=0
RacingRotation=MapSettings=("map=WashBoard gametype=NATS month=jun time=noon","map=VehicleAdvExampleMap gametype=NATS month=dec time=7am","map=WashBoard gametype=SX month=jul time=2pm")

+DefaultGameTypeInfos=(Prefix="FR",GameType="/Script/FastLine.FLFreeRide")
+DefaultGameTypeInfos=(Prefix="SX",GameType="/Script/FastLine.FLSuperCross")
+DefaultGameTypeInfos=(Prefix="NATS",GameType="/Script/FastLine.FLNationals")


Any ideas why FString ChosenMap = RacingRotation.MapSettings[MapRotationIndex]; can not be read from config file?

Someone, Anyone?

here are the error lines when it crashes



[2021.03.15-19.46.00:546][779]LogGameType: AFastLineGameMode::DedicatedMapRotation() has started up
[2021.03.15-19.46.00:546][779]LogGameType: AFastLineGameMode::DedicatedMapRotation() RacingRotation.MapSettings.Num() is 0
[2021.03.15-19.46.00:546][779]LogGameType: AFastLineGameMode::DedicatedMapRotation() MapRotationIndex is 0
[2021.03.15-19.46.00:546][779]LogGameType: AFastLineGameMode::GetRaceRotation() RacingRotation.MapSettings.Num() is 0
[2021.03.15-19.46.00:546][779]LogGameType: AFastLineGameMode::GetRaceRotation() MapRotationIndex is 0
[2021.03.15-19.46.00:546][779]LogOutputDevice: Warning:

[2021.03.15-19.47.00:916][779]LogWindows: Error: Assertion failed: (Index >= 0) & (Index < ArrayNum) [File:C:\Program Files\Epic Games\UE_4.26Chaos\Engine\Source\Runtime\Core\Public\Containers/Array.h] [Line: 674]
[2021.03.15-19.47.00:916][779]LogWindows: Error: Array index out of bounds: 0 from an array of size 0


Any ideas?

Tried adding these, the + and TEXT(" ") to the config line. No luck.



+RacingRotation=MapSettings=(TEXT("map=WashBoard gametype=NATS month=jun time=noon"),TEXT("map=VehicleAdvExampleMap gametype=NATS month=dec time=7am"),TEXT("map=WashBoard gametype=SX month=jul time=2pm"))


It just seems these are not put into memory for use.