Hey guys,
I wanted a timer displaying in my console, which Shows how many seconds passed since the start of my game.
The Problem is that:
void SomeActor::Tick(float DeltaTime){
Super::Tick(DeltaTime);
static float RealTime = 0;
RealTime += DeltaTime;
}
doesnt give me the Real Time passed since the start.
I tried a bunch of stuff and I noticed that DeltaTime is 5 times the RealTimeDelta.
void AShowroomProduct::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
static int i = 0;
static Time = 0;
static float FalseTime= 0;
if (i == 0)
{
i++;
//Global Variable (Initialized with 0)
LastFrameTime = GetWorld()->GetRealTimeSeconds();
}
float RealDelta = GetWorld()->GetRealTimeSeconds() - LastFrameTime;
LastFrameTime = GetWorld()->GetRealTimeSeconds();
Time += RealDelta;
FalseDelta += DeltaTime;
UE_LOG(LogTemp, Warning, TEXT("Realtime Delta: %f\nTime till Start: %f\nStandardDelta: %f\nDeltatime Till Start: %f"), RealDelta, Time, DeltaTime, FalseDelta);
}
Heres a Picture of the log:
Thanks
Greetings