Updating Statisics
All unlocking is performed through the "PlayerStatsSubSystem". In Blueprint it's easy to access this. Accessing the SubSystem through C++ will take a few extra steps to set up.
- Blueprint
- C++
To access functions in Blueprint simply search for ‘Get PlayerStatsSubSystem’ in any blueprint editor. Use the SubSystem object to call the required functions.
#include "PlayerStatsSubSystem.h"
...
UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(GetWorld());
UPlayerStatsSubSystem* PlayerStatisticsSubsystem = GameInstance->GetSubsystem<UPlayerStatsSubSystem>();
PlayerStatisticsSubsystem->AddToCounter(FName("ExampleKey"), 1.0);
Note on C++
You must add the PlayerStatistics as a public dependency in your ProjectName.Build.cs file. To gain access to the subsystem.
PublicDependencyModuleNames.AddRange(new string[] {"PlayerStatistics"});
C++ Examples: https://gist.github.com/SamCarey99/0020bd475e556c3615305747253537bd