# How to Set Timeline Position via Slider?

**URL:** <https://qa.fmod.com/t/how-to-set-timeline-position-via-slider/16865>\
**Category:** Unity\
**Created:** [March 12, 2021, 12:45am UTC](https://qa.fmod.com/t/how-to-set-timeline-position-via-slider/16865 "2021-03-12T00:45:57Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dafar](https://avatars.discourse-cdn.com/v4/letter/d/74df32/32.png) [@dafar](https://qa.fmod.com/u/dafar)\
**Post date:** [March 12, 2021, 12:45am UTC](https://qa.fmod.com/t/how-to-set-timeline-position-via-slider/16865/1 "2021-03-12T00:45:57Z")

</div>

Hi,

I have a music (4 minutes) that I want to add a slider that changes the timeline playback position.

I could get the timeline position and make the slider move accordingly, but I calculated the milliseconds by hand.

```
[SerializeField]
private Slider lengthSlider;

private void Update()
{
    myTimelinePosition();
}

public void myTimelinePosition()
{
    EventInstance.getTimelinePosition(out int position);

    lengthSlider.value = position;
}

```

I have 2 questions:

1. Is it possible to get the length of a timeline or a region automatically?

2. Is it possible to change via slider in Unity the positioning of the play head and continue the music from that new position? Like we do when watching a video in youtube. We see the progress bar and click on the bar to move to a different part of the video/music.

Thanks!!!

---

<div class="post-metadata">

**Author:** ![alexzzen](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/alexzzen/32/6825_2.png) [@alexzzen](https://qa.fmod.com/u/alexzzen)\
**Post date:** [March 12, 2021, 12:13pm UTC](https://qa.fmod.com/t/how-to-set-timeline-position-via-slider/16865/2 "2021-03-12T12:13:32Z")

</div>

1. To get the length of the timeline get the EventDescription from the EventInstance with [Studio::EventInstance::getDescription](https://www.fmod.com/resources/documentation-api?version=2.1&page=studio-api-eventinstance.html#studio_eventinstance_getdescription), then you can call [Studio::EventDescription::getLength](https://www.fmod.com/resources/documentation-api?version=2.1&page=studio-api-eventdescription.html#studio_eventdescription_getlength).

2. Have you tried using [Studio::EventInstance::setTimelinePosition](https://www.fmod.com/resources/documentation-api?version=2.1&page=studio-api-eventinstance.html#studio_eventinstance_settimelineposition)? You can set your instance to a new position using that.
