I’m trying to get the MinDistance and MaxDistance attributes of events in a OnDrawGizmos, but for that I need to get the EventDescription which is only possible through RuntimeManager. In the latest updates, it can’t be accessed anymore in the Editor, and the error message encourages you to “create your own System objects”, which is essentially initializing a FMOD Studio System.
I have tried making my own FmodSystem but it doesn’t seem to be loading the events (everytime I try to get an event through ID or name, it says it doesn’t exist), and I believe it’s generating a conflict since more than one is being created in the editor.
public static FMOD.Studio.System FmodSystem
var result = FMOD.Studio.System.create(out var studioSystem);
if (result != FMOD.RESULT.OK)
Debug.LogError("[FMOD/STMOD] FMOD Studio System couldn't be initialized: "+result);
INITFLAGS studioInitFlags = INITFLAGS.NORMAL | INITFLAGS.DEFERRED_CALLBACKS;
studioSystem.initialize(0, studioInitFlags, FMOD.INITFLAGS.NORMAL, IntPtr.Zero);
_fmodSystem = studioSystem;
Worst thing is, if I comment out the RuntimeManager’s conditional to use it only if the game is playing, everything works out fine, but I imagine it’s not intended.
Is there any documentation or way to use FMOD’s System correctly? Thanks!
The only thing you seem to be missing is bank loading. To retrieve an EventDescription, you will need to load the bank it belongs to. If you’re planning to retrieve it by path, you will also need to load the Master strings bank.
While it is technically possible to call into RuntimeManager to create a Studio System, it is only designed to be used at runtime. This is because RuntimeManager destroys the created System in OnDestroy(), which only happens when a scene or game ends. so you’ll leak the Studio System in the current editor instance when calling from outside of runtime. FMOD can support up to eight Systems at once - once you call into RuntimeManager eight times from the editor, FMOD will no longer be able to create a new system until you restart the editor.