Beginner Question : Why isn't the same in the editor and as standalone game?

Hello!
I am a beginner in UE4 and created a project to test my knowledge but I don’t understand , why is my game not the same in the editor and as standalone game.
When I play it in the editor than everything works fine but when I launch the project or run it as a standalone game the Actors (the lifts) moving faster and going higher.

Video ( game in the editor ) - https://streamable.com/6ajhi5
Video ( standalone game ) - https://streamable.com/v2rw0c


ALift::ALift()
{
PrimaryActorTick.bCanEverTick = true;
StaticMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("CustomStaticMesh"));
PlacedLocation = FVector(0.0f);
bShouldFloat = false;
RunningTime = 0.0f;
Speed = 0.0f;
}


void ALift::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
if (bShouldFloat)
{
PlacedLocation = GetActorLocation();
BaseLocation = PlacedLocation.Z;
FVector NewLocation = GetActorLocation();
NewLocation.Z = BaseLocation + (Speed) * FMath::Sin(RunningTime);
SetActorLocation(NewLocation);
RunningTime += DeltaTime;
}
}

Editor window is likely capped at 30FPS (or lower) while your actual game isn’t. You need to modify your speed by delta time to account for that difference.



NewLocation.Z = BaseLocation + (Speed * DeltaTime) * FMath::Sin(RunningTime);


Thank You !

Somewhat related - from a level designer / animator usability standpoint, you should designate a platform begin point and endpoint. Then designate a “round trip time” in seconds.

I’ve seen animation systems that use “speed” but that is arbitrary depending on size of objects and distances. Designer / animator wants to say “move from point A to point B in X seconds” which will always be the same regardless of object size or distances. :wink: