How to control Music track with the UI slider

Hie I am Creating a music player in unity 3D 5.6.2 and I am Stuck on how to make the current playing track match the value of the UI slider to control the Music
Any help will be appreciated
Please Reply Soon…!!

You probably will want to create a new script that contains methods that look something like this(C#):

    public AudioSource audioSource;
    public Slider slider;

    public void ChangeAudioTime()
    {
        audioSource.time = audioSource.clip.length * slider.value;
    }

    public void Update()
    {
        slider.value = audioSource.time / audioSource.clip.length;
    }

Attach this script to a game object and setup the audio source and slider values to point to your respective game objects. Then, in the slider game object, hook up the on value change event to point to the ChangeAudioTime method that we just defined. This should allow you to drag the slider to adjust the current position in the song. I also added the update to constantly set the value of the slider to the current position in the song.

You might also need to write some additional logic to make it so the song doesn’t play while you are dragging the slider, but this should help you get started. Good Luck!

its working , but i cant move the slider the in order to chage the position of the track…