2D Rougelike Tutorial-Part 13 -Music Will Not Play
I'm on part 13 of the 2d rougelike tutorial. I did every thing the tutorial said and music wont play.
[code=CSharp]
using UnityEngine; using System.Collections;
public class SoundManager : MonoBehaviour { public AudioSource soundEffects; public AudioSource backgroundMusic;
public float lowPitch = .95f;
public float highPitch = 1.95f;
public static SoundManager instance = null;
// Use this for initialization
void Awake () {
if (instance = null)
instance = this;
else if (instance != this)
Destroy(gameObject);
DontDestroyOnLoad(gameObject);
}
public void PlaySingle(AudioClip clip)
{
soundEffects.clip = clip;
soundEffects.Play();
}
public void RandomizeMusic(params AudioClip[] clips)
{
int randomIndex = Random.Range(0, clips.Length);
float randomPitch = Random.Range(lowPitch, highPitch);
soundEffects.pitch = randomPitch;
soundEffects.clip = clips[randomIndex];
soundEffects.Play();
}
// Update is called once per frame
void Update () {
}
}
[code/]
Comment