Length of an event not on runtime (editor scripts)

I have a property drawer (editor script) that displays a custom class that used to hold an audio clip. I used to get the length of that clip and display while editing. This is extremely valuable information when you also have to sync subtitles to the audio being spoken.

I’ve now implemented FMOD and am in the process of changing all my direct audio clips into FMOD events. This is a good thing as it allows my sound designers to have more control over my audio.

The problem is that I don’t know how to get the length of an event not on runtime, but in an editor script.

My code looks like this and works on runtime:


int fmodLength;

FMOD.RESULT res = FMODUnity.RuntimeManager.GetEventDescription(fmodEvent).getLength(out fmodLength);

if (res == FMOD.RESULT.OK)
length = fmodLength;


The problem is that this uses the RuntimeManager which clearly won’t work in editor.

The information about the event is present in the bank files, I just don’t know how to get it, or if it is possible at all. If it’s not, it really really needs to be.

Is there any solution to this?

Thank you

The RuntimeManager will only work at Runtime because the System does not get created and initialized until the game is started.

There is a FMOD System created for the Editor (EditorUtils.System), although it cannot be accessed by anything outside of the Editor directory because Unity keeps them separate.

Have a look through the Integration Editor files to give you an idea of how to use and access events through it (eg. EventManager.cs, EditorUtils.cs).

Trying to find documentation on this but I’m lost. Any chance to get a link to where I should look to learn how to call EditorUtils.cs from a Unity Editor only script?

We don’t currently have any documentation for the Editor scripts.
I will add a task to add documentation for it in a future release.