Music Manager (MAG episode 13)

Updated on August 13, 2015 in [A] Audio
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
2 on August 12, 2015

I don’t get any error, also when I play the game I don’t get any error, but it just doesn’t play the music. Here is my script:

#pragma strict

static var currentScore : int = 0;

var offsetY : float = 40;
var sizeX : float = 100;
var sizeY :float = 40;

var musicPrefab : Transform;

function Start () {
currentScore = 0;

if (!GameObject.FindGameObjectsWithTag(“MM”)) {
var mManager = Instantiate (musicPrefab, transform.position, Quaternion.identity);
mManager.name = musicPrefab.name;
DontDestroyOnLoad (mManager);
}

}

function OnGUI () {
GUI.Box (new Rect (Screen.width/2-sizeX/2, offsetY, sizeX, sizeY), “Coins: ” + currentScore + ” – 3″);
}

I did attach the music object on the var “musicPrefub”, and I did attach the relaxing music to the music object.

  • Liked by
Reply
1 on August 13, 2015

Uhh… Is Play on Awake on?

Devoted
on August 13, 2015

Yes.

Show more replies
  • Liked by
Reply
Cancel