Created
August 18, 2015 01:10
-
-
Save joshalanwagner/4486c6f3370ee1a62369 to your computer and use it in GitHub Desktop.
Alternate code for Music Player script.
This file contains hidden or 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 MusicPlayer : MonoBehaviour { | |
| static bool initialRun = true; | |
| void Start () | |
| { | |
| if (initialRun == true) { | |
| GameObject.DontDestroyOnLoad (gameObject); | |
| initialRun = false; // It will be false the next time this script is run | |
| } else { | |
| Destroy (gameObject); | |
| print ("Destroy duplicate"); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment