'Timeline go to last frame

Is there a way to make my timeline go to last frame and just pause there? I know there is PlayableDirector.time but I want my script to automatically find out the last frame of the timeline. How do I do this?

using UnityEngine.Playables;

public PlayableDirector currentTimeline;

void Start(){
  currentTimeline.time = 0; //Go to last frame
  currentTimeline.Pause();
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source