Skip to content

Commit

Permalink
Audio duplication glitch fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarker committed Jun 11, 2021
1 parent a5be655 commit f150339
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Colormancy/Assets/Audio/AudioScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

public class AudioScript : MonoBehaviour
{
private static AudioScript s_instance;

public enum SongType { LOBBY, STAGE, BOSS }

[SerializeField]
Expand All @@ -12,6 +14,15 @@ public enum SongType { LOBBY, STAGE, BOSS }
private AudioSource _audioSource;
private void Awake()
{
if (s_instance != null && s_instance != this)
{
Destroy(this.gameObject);
}
else
{
s_instance = this;
}

DontDestroyOnLoad(transform.gameObject);
_audioSource = GetComponent<AudioSource>();
}
Expand Down

0 comments on commit f150339

Please sign in to comment.