Skip to content

Instantly share code, notes, and snippets.

@naojitaniguchi
Created July 21, 2015 08:56
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 naojitaniguchi/a56b47f5cbf64214dfaa to your computer and use it in GitHub Desktop.
Save naojitaniguchi/a56b47f5cbf64214dfaa to your computer and use it in GitHub Desktop.
SimpleBGMPlayer for Unity
using UnityEngine;
using System.Collections;
public class SimpleBGMPlayer : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void startBGM(){
AudioSource audioSource = gameObject.GetComponent<AudioSource>();
audioSource.Play();
}
public void stopBGM(){
AudioSource audioSource = gameObject.GetComponent<AudioSource>();
audioSource.Stop();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment