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