Singleton Sound Manager

Starting with Unity having had experience of XNA im not sure if the way i want to solve my problem is the correct way. So id like the opinion of more experienced people.

I am doing a 2.5D game and have no need for 3D sounds that generate from a certain 3D position. I am used to creating a sound manager class that handles the loading of sound assets and has a static public method for each sound effect. This way it works like a toolbox i can call SfxManager.PlayDeathScreamSfx(); from anywhere in the solution.

How could i do the same in Unity?

I have tried making a game object called soundmanager and given it static methods that would play the sound effects but the SoundClips needs to be static for the static methods to be able to use them. And if the SoundClips are static then they dont show up in the inspector and i cant drag’n’drop a sound file on them to reference them.

What to do?

Never use singletons in Unity.

Lately I’ve been using this system, which really seems to solve all problems.

My most recent long explanation of it:

older explanations:

It is far easier. I hope it helps you.

"This way it works like a toolbox i can call SfxManager.PlayDeathScreamSfx(); from anywhere in the solution. How could i do the same in Unity?’

The only workable answer in Unity is the (really trivial) “Grid” solution I outline.

In your example you would just be calling Grid.sfx.DeathScream()

You can simply copy the code from that long answer above (here) and do it.

As I say in the others,

(A) singletons are a non-starter in a Unity project

(*) anything that “isn’t a monobeaviour” causes trouble in the end

(*) once you do accept that anything you do needs to simply be a normal component stuck on a game object … then everything is easy, right?