Skip to content

Instantly share code, notes, and snippets.

@WakkyFree
Created March 14, 2018 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WakkyFree/212393c78f04b3a112631b69851ca216 to your computer and use it in GitHub Desktop.
Save WakkyFree/212393c78f04b3a112631b69851ca216 to your computer and use it in GitHub Desktop.
Unity script to control BGM
using UnityEngine;
using System.Collections;
public class BgmControl : MonoBehaviour {
public AudioSource myAudioSource;
// Use this for initialization
void Start () {
myAudioSource = GetComponent<AudioSource>();
}
// Update is called once per frame
void Update () {
if(CountDownTimer.gameTimerInt == 0) {
myAudioSource.Stop();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment