-
haziqam authoredfa92ecdb
AudioManagerScript.cs 733 B
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AudioManagerScript : MonoBehaviour
{
public AudioSource audioSource;
public static AudioManagerScript Instance;
private void Start()
{
}
private void Update()
{
}
private void Awake()
{
if (Instance == null)
{
Instance = this;
DontDestroyOnLoad(gameObject);
}
else
{
Destroy(gameObject);
}
}
public void PlaySFX(AudioClip clip)
{
audioSource.PlayOneShot(clip);
}
public void ChangeVolume(float volumePercentage)
{
audioSource.volume = volumePercentage / 100f;
}
}