RealtimeStyleTransferRuntime/Source/LyraGame/UI/PerformanceStats/LyraPerfStatWidgetBase.cpp

36 lines
821 B
C++
Raw Normal View History

2022-05-23 18:41:30 +00:00
// Copyright Epic Games, Inc. All Rights Reserved.
#include "LyraPerfStatWidgetBase.h"
#include "Performance/LyraPerformanceStatSubsystem.h"
//////////////////////////////////////////////////////////////////////
// ULyraPerfStatWidgetBase
ULyraPerfStatWidgetBase::ULyraPerfStatWidgetBase(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
}
double ULyraPerfStatWidgetBase::FetchStatValue()
{
if (CachedStatSubsystem == nullptr)
{
if (UWorld* World = GetWorld())
{
if (UGameInstance* GameInstance = World->GetGameInstance())
{
CachedStatSubsystem = GameInstance->GetSubsystem<ULyraPerformanceStatSubsystem>();
}
}
}
if (CachedStatSubsystem)
{
return CachedStatSubsystem->GetCachedStat(StatToDisplay);
}
else
{
return 0.0;
}
}