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?