Pretty much what the title says. It’s just that the first time it plays it completely hangs the game for a second and then resumes normally. After that the sound is played exactly on time, no delay or anything
Here is the code :
private int Score;
private AudioSource Source;
void Start ()
{
Source = GetComponent<AudioSource>();
Score = 0;
}
void OnTriggerExit2D(Collider2D other)
{
if (other.CompareTag("Score"))
{
Source.Play();
Score++;
Debug.Log(Score);
}
}