How to get current frame in current Level Sequence?

In case the node did not work, you can use this snippet. I am using it in my plugin as well.

int32 GetCursorFrameNumber(ULevelSequence* LevelSequence)
{
  auto toolKit = FToolkitManager::Get().FindEditorForAsset(LevelSequence);
  if (toolKit)
  {
    IToolkit* toolKit_p = toolKit.Get();
    if (auto levelSequenceEditorToolkit = static_cast<ILevelSequenceEditorToolkit*>(toolKit_p))
    {
      if (auto sequencer = levelSequenceEditorToolkit->GetSequencer())
      {
        return ConvertFrameTime(sequencer->GetGlobalTime().Time, sequencer->GetFocusedTickResolution(), sequencer->GetFocusedDisplayRate()).FloorToFrame().Value;
      }
    }
  }

  return -1;
}

2 Likes