AudioSource audioData;
void Start()
{
audioData = GetComponent<AudioSource>();
audioData.Play(0);
Debug.Log("started");
}
public AudioSource audioData;
void Start()
{
audioData.Play();
}
using System.Collections;
using UnityEngine;
public class AudioManager : MonoBehaviour
{
[SerializeField]
private AudioSource sampleAudioSource = null;
void Awake(){
if (sampleAudioSource == null)
Debug.LogError("AUDIO_MANAGER: sampleAudioSource is NULL");
}
public void PlaySampleSound()
{
sampleAudioSource.Play();
}
}
public AudioSource audioSource;
public AudioClip audioClip;
[Range(0, 1)] public float volume;
void Start()
{
audioSource = GetComponent<AudioSource>();
}
void DoStuff()
{
audioSource.PlayOneShot(audioClip, volume);
}