Cleanest way to decouple Manager class with events

So here’s my dilemma. I’ve been kicking around online many hours the last few weeks trying to figure out a solution to my problem.

I have an animation system and sound system in use throughout multiple scenes in my game which I instantiate when I need them. I’m naming the sound system class AudioManager in this instance. The AudioManager is one of the few singletons I have in my game.

I have scripts attached to different prefabbed game objects that I instantiate that make noise. These objects come and go so it’s not like I can just click and drag these onto the AudioManager. I want to be able to just essentially broadcast an audio play event like PlayNoise(“coinDrop”) in an ignorant way from anywhere in these scripts and have AudioManager listen for it and handle the fadein/fadeout and intricacies. I could do that easily by just referencing the audiomanager as a singleton and calling AudioManager.Instance.PlayNoise(“blah”) but the one improvement I’d like to make is that I’d like to be able to totally remove the AudioManager from the entire project and still have the game work without having to change any code or recompile anything. I don’t really want to have a bunch of delegate subscribers and list a bunch of functions either. Just a simple event broadcast out.

The purpose for this is that I’m looking for more modularity. I’ve done the drag and link with OnClick and unity events and it works great for in game scenes but works like garbage when you have an intricate UI system and you need to be able to prefab everything.

TL:DR; I want to announce an event from multiple classes/gameobjs without having to know anything at all about the listener (e.g. no delegate subscribers in every class I need to make a sound from). The listener knows nothing about the announcers; it just knows to do something when it hears an event. I’ve heard of SendMessage but I’ve heard negative things about it with regard to efficiency and it sounds like some protocode from when Unity was new.


Something like Create a Simple Messaging System with Events - Unity Learn ?