So my goal was to set up a system where I could quickly change up level sets for my various game modes in project settings during testing.
I made this class to store 3 composite tables in project settings:
UCLASS(Config = Game, defaultconfig, meta = (DisplayName="Level Settings"))
class MARBLE0001_API ULevelSettings : public UDeveloperSettings
{
GENERATED_BODY()
public:
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly)
TSoftObjectPtr<UCompositeDataTable> singlePlayerLevels;
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly)
TSoftObjectPtr<UCompositeDataTable> arcadePlaylists;
UPROPERTY(Config, EditAnywhere, BlueprintReadOnly)
TSoftObjectPtr<UCompositeDataTable> challengeLevels;
};
I then wrote some functions to read these table references:
.h
UCLASS()
class MARBLE0001_API ULevelInfoFunctions : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
UFUNCTION(BlueprintPure)
static UCompositeDataTable* getSinglePlayerLevels();
UFUNCTION(BlueprintPure)
static UCompositeDataTable* getArcadePlaylists();
UFUNCTION(BlueprintPure)
static UCompositeDataTable* getChallengeLevels();
};
.cpp
UCompositeDataTable* ULevelInfoFunctions::getSinglePlayerLevels()
{
const ULevelSettings* LevelSettings = GetDefault<ULevelSettings>();
return LevelSettings ? LevelSettings->singlePlayerLevels.Get() : nullptr;
}
UCompositeDataTable* ULevelInfoFunctions::getArcadePlaylists()
{
const ULevelSettings* LevelSettings = GetDefault<ULevelSettings>();
return LevelSettings ? LevelSettings->arcadePlaylists.Get() : nullptr;
}
UCompositeDataTable* ULevelInfoFunctions::getChallengeLevels()
{
const ULevelSettings* LevelSettings = GetDefault<ULevelSettings>();
return LevelSettings ? LevelSettings->challengeLevels.Get() : nullptr;
}
The issue im having is that when I load the project, only the first (single player levels) data table loads. The others return null UNLESS i re-add the table reference in the project settings, and then they will start working as expected.
Im really confused as to why this is happening, and im hoping it is something that i can fix since its very annoying having to clear and re-set the datatables in the project settings each time I load the project.
Its probably also worth mentioning that I did also try UDataTable also, since the bottom two don’t actually need to be composite, but I thought maybe the issue was that data tables wouldn’t work so I changed them all to comp tables.
The config file looks like this:
[/Script/Marble0001.LevelSettings]
singlePlayerLevels=/Game/Data/Data_LostMarbles/Levels/CData_SinglePlayer.CData_SinglePlayer
arcadePlaylists=/Game/Data/Data_LostMarbles/Levels/CData_ArcadePlaylists.CData_ArcadePlaylists
challengeLevels=/Game/Data/Data_LostMarbles/Levels/CData_Challenges.CData_Challenges
I have tried clearing everything like saved and intermediate folders etc, but none of that seemed to work. I appreciate if anyone has any insight into this issue, thanks!