AudioSource.playOnAwake

var playOnAwake : boolean

Description

If set to true, the audio source will automatically start playing on awake

JavaScript
    @script RequireComponent(AudioSource)
function Start() {
if(!audio.playOnAwake) {
audio.Play(); // Play the clip if it wasn't set to play on awake
}
}

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(AudioSource))]
public class example : MonoBehaviour {
void Start() {
if (!audio.playOnAwake)
audio.Play();

}
}

import UnityEngine
import System.Collections

[RequireComponent(AudioSource)]
class example(MonoBehaviour):

def Start():
if not audio.playOnAwake:
audio.Play()