Audio Clip time

how can I store in a variable the length of an audio clip? thanks :smiley:

Something like this:

using UnityEngine;
using System.Collections;

public class SoundLength : MonoBehaviour {

	public AudioClip soundLoop;	
	private float soundLength;  //the variable
	
	void Start(){
		
		audio.clip = soundLoop;
		audio.Play ();	
		
		//the length of the sound
		soundLength = soundLoop.length;
		
		
		Debug.Log(soundLength);
	}
}

Yes that’s pretty smart, thanks :smiley: but this code will actually plays the clip. I need the value to store it in a slider, I’ve a button to play the clip :smiley: