StudioEventEmitter - ParamRef[] Params


I’ve been working with FMOD since Unity 4.x and have improving skills with the IDE as it evolves. Currently, i’m using the new 1.08.09v and making a new integration to our game on our Studio.

I’m getting a NullReferenceException in ParamRef[] Params by creating a dynamic StudioEventEmitter as the game needs with a static function:

public static StudioEventEmitter CreateEmitter(GameObject obj, string eventToCreateFrom, bool triggerAtStart = false)
        StudioEventEmitter emitter;
        emitter = obj.AddComponent<StudioEventEmitter>();
        string eventAsset = eventToCreateFrom.ToLower();
        emitter.Event = eventAsset;
        emitter.TriggerOnce = triggerOnce;


        return emitter;

My question is: Should i initialize the emitter.Params empty or it’s a bug? My event does not have any parameter.

Thank you.


I added emitter.Params = new ParamRef[0]; to my code and even if the event has or not params, it seems to work properly now. So, use this as a recomendation if you are creating dynamic emitters in your game.

Thank you.

I’ve fixed this up in the next official release.

But unlike the Unity audio system and it’s requirement that you create an AudioSource component before playing a clip, in FMOD we recommend you play events directly in code (EventEmitter is still fine for placing at design time).

See the Scripting Basics example.

Hello Nicholas, thanks for your reply.

I saw that a couple of things changed from older versions of FMOD. Your link is really useful and I will take a note about not create emitters and track everything with event instances by code