Live Config
Loading...
Searching...
No Matches
LiveConfigJson.h
1// Copyright (c) 2026 Nicholas Arthur
2// Licensed under the MIT License
3
4#pragma once
5
6#include "CoreMinimal.h"
7#include "Subsystems/EngineSubsystem.h"
8#include "LiveConfigSystem.h"
9#include "LiveConfigJson.generated.h"
10
14UCLASS(BlueprintType)
15class LIVECONFIG_API ULiveConfigJsonSystem : public UEngineSubsystem
16{
17 GENERATED_BODY()
18public:
19 static ULiveConfigJsonSystem* Get();
20
21 // USubsystem
22 virtual void Initialize(FSubsystemCollectionBase& Collection) override;
23 virtual void Deinitialize() override;
24 // ~USubsystem
25
26 void LoadJsonFromFiles();
27
28 UFUNCTION(Exec)
29 void VerifyJsonIntegrity();
30
31 void SavePropertyToFile(const FLiveConfigPropertyDefinition& PropertyDefinition);
32 void DeletePropertyFile(FName PropertyName);
33 void RenamePropertyOnDisk(FName OldPropertyName, FName NewPropertyName);
34
35 static FString GetPropertyPath(FName PropertyName);
36 static FString GetLiveConfigDirectory();
37
38 void FlushPendingSaves();
39
40 // for testing
41 bool bDisableFileOperations = false;
42private:
43 void LoadJsonFromDirectory(const FString& Dir);
44 void LoadJsonFromFile(const FString& Path, const FString& FileName);
45
46 void QueueSave();
47 bool OnTick(float DeltaTime);
48
49 TMap<FName, FLiveConfigPropertyDefinition> QueuedSaves;
50 TSet<FName> QueuedDeletions;
51 FTSTicker::FDelegateHandle TickHandle;
52};
Definition LiveConfigJson.h:16
Definition LiveConfigTypes.h:58