FMOD Studio::Bank:getEventList is giving me a disorder event list, how can I order it alphabetically?

I have an Unity project that has implemented FMOD audio.

When I try to retrieve an event list of a bank the events of the list are in disorder.

My code:

FMOD.Studio.Bank bank;
FMOD.Studio.EventDescription[] eventDescription;

RuntimeManager.StudioSystem.getBank("BankName", out bank);
var result = bank.getEventList(out eventDescription);

if (result == FMOD.RESULT.OK)
{
    foreach (var eventDesc in eventDescription)
    {
	eventDesc.getPath(out outString);
	Debug.Log("outString: " + outString);
    }
}

My debug event list’s events output
evidence1

How my bank is set on FMOD Studio
evidence2

Thanks in advance for your help!

1 Like

The event list is ordered by the GUID of the events, not the string names. This allows users to still get the event list of a bank even if they haven’t loaded the .strings bank.

You will need to use Array.Sort() and sort the array by the event path in order to get the list to be alphabetical.

1 Like

Thanks for your answer and explanation!
Sorry but I can’t figure out how to sort using Array.Sort(), I attempting to do a solution similar at this:

string o1 = "", o2 = "";
        Array.Sort(eventDescription, (a1, a2) => String.Compare(a1.getPath(out o1), a2.getPath(out o2)));

But it’s indicating me an error, any ideas? Thanks in advance again!

getPath returns FMOD.Result so that’s why it’s returning an error.

You would need to sort it by the out string.

Array.Sort(descriptions, (a1, a2) => {
   a1.getPath(out o1);
   a2.getPath(out o2);
   return String.Compare(o1, o2);
});
1 Like

You’re right! sorry I never have worked with out methods and they are a little confussing for me.

Thanks for all your kindly help.