Download

Timeline playing twice as fast in C++?

I made two floating objects, one in C++, and one in Blueprints. I use the same float curve for both timelines. For some reason, the C++ object moves twice as fast! I haven’t adjusted the playback rate or anything else that would affect it, so I can’t figure out why.

I’ve attached the code for this actor. If you un-comment the SetPlayRate(0.5f) call in the constructor, it will move the same speed as the blueprint!

Anyone know what is going on here?

Thanks!

You don’t need to manually call TickComponent, since this is automatically done by the AActor. :slight_smile: TickComponent being called twice per frame is causing what you see.



void AFloatingTorusActor::Tick(float DeltaTime)
{
    Super::Tick(DeltaTime);

    // This is wrong
    TimelineComponent->TickComponent(DeltaTime, ELevelTick::LEVELTICK_TimeOnly, nullptr);
}


Thank you so much for your response, that is correct. I do wonder why the tutorials online, for example, https://wiki.unrealengine.com/Timeline_in_c%2B%2B have this mistake in them. I’m guessing something changed in the engine at some point to remove that need.

Thank you so much!