No MusicPlayer Found while Saving Volume

I’m missing a step I think, but I can’t for the life of me find it. (And on another note, I’d implemented an AudioMixer solution from Youtube, which worked, but I couldn’t figure out how to use that with PlayerPrefs… if you could point me in the right direction of that one I’d be very grateful, but I’m not sure if there is any?)

This script somehow messes with the MusicPlayer. If I disable it, I hear music, if it’s attached to my MusicPlayer, no music plays.

And this is the Audiomixer solution I’d done before:

Also I get this error:

“NullReferenceException: Object reference not set to an instance of an object
MusicPlayer.SetVolume (System.Single volume) (at Assets/MusicPlayer.cs:21)
AudioController.Update () (at Assets/AudioController.cs:22)”

Hi Asli,

NullReferenceException means that a reference (“link”) to an instance is missing. Double click on the error message to see to which line in your code it is referring. If you exposed a field in the Inspector, make sure that it’s not empty.

Please note, it’s better to copy/paste your code and apply the code fencing characters, rather than using screenshots. Screenshots are ideal for displaying specific details from within a game engine editor or even error messages, but for code, they tend to be less readable, especially on mobile devices which can require extensive zooming and scrolling.

You also prevent those that may offer to help you the ability to copy/paste part of your code back to you with suggestions and/or corrections, meaning that they would need to type a potentially lengthy response. You will often find that people are more likely to respond to your questions if you make it as easy as possible for them to do so.

Hope this helps :slight_smile:


See also;

Oops, sorry, I thought I was making it easy with the screenshots!

If there was an error which is only visible in Visual Studio, you could provide a screenshot of that part. For everything else, I prefer text because I tend to produce lots of typo.

How are you getting on with this, @Asli_Tumerkan?

Privacy & Terms