Hi!
It seems, I found new bug in the function AActor::Tick. Her parameter returns time since last frame. But I expected, that this parameter returns time since last call function AActor::Tick.
Code for reproduction this bug below.
DeltaTimeBug.h
#pragma once
#include "GameFramework/Actor.h"
#include "DeltaTimeBug.generated.h"
UCLASS()
class TESTPROJECT_API ADeltaTimeBug : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
ADeltaTimeBug();
// Called every frame
virtual void Tick( float DeltaSeconds ) override;
};
DeltaTimeBug.cpp
#include "TestProject.h"
#include "DeltaTimeBug.h"
// Sets default values
ADeltaTimeBug::ADeltaTimeBug()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
PrimaryActorTick.TickInterval = 1.0f / 30.0f;
}
// Called every frame
void ADeltaTimeBug::Tick( float DeltaTime )
{
Super::Tick( DeltaTime );
UE_LOG(LogTemp, Warning, TEXT("DeltaTime: %f"), DeltaTime);
static float prevTime = GetWorld()->TimeSeconds;
UE_LOG(LogTemp, Warning, TEXT("RealTime: %f"), GetWorld()->TimeSeconds - prevTime);
prevTime = GetWorld()->TimeSeconds;
}
And the result picture (in game fps was equal 120):
I hope you fix it