How can I preview Programmer Sounds in Unity Editor (accessing the AudioTable)?

I’ve used the EventBrowser.cs as well as EditorUtils.cs to create my own Audio preview editor in Unity, and I’m able to play event sounds just like the Event Browser.

The issue I’m running into is that I can’t figure out how to preview/access Programmer sounds.
I can’t figure out how to access an AudioTable and assign it to an EditorEventRef through the Editor. Kind of like we would do in-game:


I can’t seem to find an example to go from in the FMOD Editor menu options, making me wonder if its possible or not.

To be more precise, I’m trying to understand how to call the equivalent methods between EventInstance methods and EditorEventRef (Or at least I assume that is the right way to go at this).

For example, if I want to change a parameter in a Editor instance rather than doing:

eventInstance.setParameterByName("parameterName", parameterValue);

I do:

foreach (EditorParamRef selectedParamRef in eventRef.Parameters) {
     if (selectedParamRef.Name == "parameterName") selectedParamRef.Default = parameterValue;

My question is, how can I do this for the following methods (used for Programmer sounds)?


Anyone? About to give up on this due to project deadlines.

setUserData and setCallback need to be called from the eventInstance that is created, are you handling that or is that being handled by the integration?

Thank you for replying Cameron That was it! I realized where the eventInstance is created and running it there works! Yay!

The only question I have is about the creation of the dialogueCallback.
For the game, I follow your tutorial and I set it on Start() :

	public void Start(){
        // Explicitly create the delegate object and assign it to a member so it doesn't get freed
        // by the garbage collected while it's being used
       ToolsAudio.dialogueCallback = new FMOD.Studio.EVENT_CALLBACK(ToolsAudio.DialogueEventCallback);

But for the editor, should I do it when I CreateSystem() or the moment I call the eventInstance? Also once it’s done, how do I remove the callback? Or that is not necessary?

You only need to create the callback before it gets used, so in this case just after the event instance is created should be fine. Also you shouldn’t need to worry about removing the callback, once the instance gets cleaned up it will remove the callback internally.