Created
July 21, 2015 08:56
-
-
Save naojitaniguchi/a56b47f5cbf64214dfaa to your computer and use it in GitHub Desktop.
SimpleBGMPlayer for Unity
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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