ERR_EVENT_NOTFOUND for a Bus

In my FMOD project I’m getting a reference to a Bus with code like this:

if (!Check(RuntimeManager.StudioSystem.getBus(busName, out var bus), $"Failed to get output bus `{busName}` from FMOD."))
    return default;

This is failing with an ERR_EVENT_NOTFOUND error:

Failed to get output bus “bus:/Voice” from FMOD. FMOD Result: ERR_EVENT_NOTFOUND

The person testing this says that bus:/Voice is a valid bus (they’ve tested an earlier prototype using that bus name).

Apart from an invalis bus name, what could cause an ERR_EVENT_NOTFOUND error in this case?

This could happen if your Master.strings.bank file has not been loaded yet. You can also try to use the GUID (right click on the bus in your project and select “Copy GUID” and see if the game code can find that bus.

Is it possible for the the strings bank to not be loaded when the Unity events (Start/OnEnable) in the scene are running (e.g. it’s loaded asynchronously). This code is running almost immediately after the scene is loaded, so that could well be the problem if so.

It certainly could be the case, especially if Unity loads the scripts in an order you’re not expecting. You can place a check for if a bank has been loaded with RuntimeManager.HasBankLoaded().

https://www.fmod.com/resources/documentation-unity?version=2.02&page=api-runtimemanager.html#hasbankloaded

Thanks, I’ve modified the system to accept paths in the editor and to convert them at edit time to IDs. Hopefully that will prevent any problems with the strings bank not being loaded at runtime (it also acts as a bit of validation that the path even exists).

How did you do this? There’s no editor API for buses and VCAs

Did you parse the string bank ?

I don’t remember the details of how this works, but it looks like this is the relevant code:

private static string? BusID(string name)
{
    if (string.IsNullOrWhiteSpace(name))
        return null;

    var result = RuntimeManager.StudioSystem.getBus(name, out var bus);
    if (result != RESULT.OK)
        return null

    var result2 = bus.getID(out var id);
    if (result2 != RESULT.OK)
        return null;

    return id.ToString();
}

This is used in the editor to convert path names supplied by the user into IDs which are stored and used at runtime. I hope that helps!

Wait, how is this used in Editor ? Any calls to the RuntimeManager outside of, well, runtime, gives me errors after errors

As far as I can see there’s nothing special to it :confused:

Here’s a very cut down example of what’s going on in my inspector:

[CustomEditor(typeof(Something))]
class DemoInspector
    : UnityEditor.Editor
{
  private string _typing;

  public override void OnInspectorGUI()
  {
    _typing= EditorGUILayout.TextField(label, _typing);
    var id = BusID(_typing);

    if (id != null)
      DoSomethingWithId(id);
  }
}

It’s likely that @martindevans1 is using an old version of FMOD for Unity, as we only added a warning when using RuntimeManager outside of runtime as of 2.02.11/2.01.20, which was released at the start of December 2022. You shouldn’t be making calls to RuntimeManager outside of runtime, as the Studio system object that is created won’t be released, and once you reach a total of eight created system objects, i.e eight calls to RuntimeManager, you cannot create any more system objects.

Instead, within the scope of your Bus path-to-ID function, you can create and initialize your own Studio system, load your bank(s), retrieve and operate on your Bus, and then release the system.

1 Like