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();
}
}
private AudioSource audio; // Get the audio
void Start()
{
audio = GetComponent<AudioSource>(); // Get the component(Add the component first and don't forget to atach the audio)
PlayAudio(); // Call the PlayAudio Function
}
void PlayAudio()
{
audio.Play(); // Play the audio use Stop() to stop the audio
}