[FMOD/Unity]Having trouble with adaptive music in 2D unity levels

Hi there I’ve been going through all the unity demos doing sound replacement with FMOD and I’ve run into a very frustrating problem. I managed to create an adaptive music system perfectly fine within the survival shooter demo but when moving on to the 2d roguelike and platformer demos the functions ive created in my music manager script are being returned null when called. I cant seem to figure out why, I’m no programmer but I’ve copied exactly what I’ve done in the survival shooter demo, been over my code hundreds of times, no spelling errors it simply doesnt make sense to me why the game would return my functions null.

To go into more detail i have a music manager gameobject in the hierarchy with a script attached to manage the music (duh).

public class MusicManager : MonoBehaviour {

public static MusicManager instance = null;

public string music = “event:/Music/Music”;
FMOD.Studio.EventInstance musicEv;

private void Awake()
if (instance == null)

    //if not, set instance to this
    instance = this;

//If instance already exists and it's not this:
else if (instance != this)




//Use this for initialization
void Start()
musicEv = FMODUnity.RuntimeManager.CreateInstance(music);



public void death()
musicEv.setParameterValue(“death”, 1f); ///<-------line 40


then in the appropriate script where the game ends on the player death ive made a reference to the music manager with

public MusicManager musicSystem;

and at the game end section of code we have

public void CheckIfGameOver() 

GameManager.instance.GameOver ();



now when the player dies and the game is over, instead changing the death parameter in fmod to 1 it returns a null reference exception at line 40 in the music manager script, so at exactly where the death() function is setting the parameter value. I’ve dealt with null reference exceptions before and knowing me im probably just missing something small but I cant for the life of me figure out what is wrong with this. Ive tried triggering the parameter in a number of different ways, also the awake function in the music manager is so that it doesnt create duplicates of itself as the the level reloads each time you complete it and you end up with lots of the same music event playing if its not there, but could that also be part of the problem somehow? Thanks for taking the time to read this! and please let me know if i am just missing something really silly.

then in the appropriate script where the game ends on the player death ive made a reference to the music manager with

public MusicManager musicSystem;

Are you then assigning a value to the “musicSystem” with something like:

 musicSystem = MusicManager.instance;

That is the only thing I can see where there may be a null reference. If you are worried that a FMOD function may not be working, most function will return a FMOD.RESULT that should help with debugging.

This worked perfectly!! thank you! been pulling my hair out over this haha and thus again i was completely thwarted by one line of code. I havent looked into to singeltons at all and although im now running into the problem of my MusicManager gameobject being reloaded each scene and stopping the music event, you have put me on the right track sir thank you very much.