How do I add sound to a sliding door animation?

I could not find an answer to this anywhere.

I have an animation done in Unity's animation editor of two doors that slide open when I get close to them using raycast, how can I get my doors to play a sound effect when they are openning?

I don't know if you need to see it but this is my door code:

enum DoorStates {open, closed};
var doorState : DoorStates;

function Awake() {
    doorState = DoorStates.closed;
}

function Update () {
}

function Open() {
    animation.Play("PwrStationDoorsOpen");
    doorState = DoorStates.open;

}

enum DoorStates {open, closed};
var doorState : DoorStates;
var doorSound : AudioClip;

function Awake() 
{
doorState = DoorStates.closed; 
}

function Update () 
{
}

function Open() 
{
animation.Play("PwrStationDoorsOpen"); 
audio.PlayOneShot(doorSound);
doorState = DoorStates.open;    
}

The only thing you really have to do is to add a variable(var) called something like:

var doorSound : AudioClip;

//And when you open the door:

audio.PlayOneShot(doorSound); 

You could use AudioSource.PlayOneShot inside your function open(), but when you want to avoid overlapping sounds you should use AudioSource.isPlaying.


Edit:

When you call PlayOneShot and animation.Play at the same time (like in OrangeLightning's answer) they should "play" together. If you want more control or an exact start time you could use Animation Events.

Take a look at the reference: Using Animation Events