AudioSource not playing

The scene is like this

First Person Controller
|
|--- AudioSource: footsteps
|--- Graphics
|--- MainCamera
    |
    |--- AudioListener
|--- SoundAmbient
    |--- AudioSource: forest ambience

The footsteps audio source is triggered in the FPSInputController script, so that i can play sound when the camera is moving and shut it down when camera is idle.

SoundAmbient audio source is not working instead. The clip is assigned in the editor and it’s working in the preview window. Ive tried

  • flagging “Play On Awake” in the editor
  • flagging “Loop” in the editor
  • removing any editor flag and adding this code in the FPSInputController Awake():

Debug.Log(GameObject.Find("SoundAmbient").audio.clip);

// Prints the clip name

var ambient : GameObject = GameObject.Find("SoundAmbient");

if (!ambient.audio.isPlaying) {
    ambient.audio.Play();
}

Debug.Log(ambient.audio.isPlaying);

// Prints true

Anyway, i can’t hear any audio from this source. Why?

Edit: i’m sorry, for some reason code won’t format properly.

public class Test : MonoBehaviour {
public AudioSource source;
public AudioClip background;
// Use this for initialization
void Start () {
source.clip = background;
source.Play();
//For Play One time
source.PlayOneShot(background);

	}
}