Advertisement
Guest User

Untitled

a guest
Oct 24th, 2014
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. var NewMusic: AudioClip; //Pick an audio track to play.
  2. function Awake () {
  3. var go = GameObject.Find("Game Music"); //Finds the game object called Game Music.
  4. if (go.audio.clip != NewMusic) {
  5. go.audio.clip = NewMusic; //Replaces the old audio with the new one set in the inspector.
  6. go.audio.Play(); //Plays the audio.
  7. }
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement