using UnityEngine;
public class SoundManager : MonoBehaviour
{
[SerializeField] AudioSource bgmAudioSource;
[SerializeField] AudioSource seAudioSource;
public void PlayBGM(AudioClip clip)
{
if (bgmAudioSource.clip != clip)
{
bgmAudioSource.clip = clip;
bgmAudioSource.Play();
}
}
public void StopBGM()
{
bgmAudioSource.Stop();
}
public void PlaySE(AudioClip clip)
{
seAudioSource.PlayOneShot(clip);
}
}
More than 1 year has passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme