public static void UpdateActiveEmitter(StudioEventEmitter emitter, bool force = false) { // If at least once listener is within the max distance, ensure an event instance is playing bool playInstance = false; for (int i = 0; i < Listeners.Count; i++) { if (Vector3.Distance(emitter.transform.position, Listeners[i].transform.position) <= emitter.MaxDistance) { playInstance = true; break; } } if (force || playInstance != emitter.IsPlaying()) { if (playInstance) { emitter.PlayInstance(); } else { emitter.StopInstance(); } } }