Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

How could I get a list of events in c# - or check one's existence (by string presumably) before posting?

0 votes

Question is straight forward - we have templated architecture for many player states which could trigger audio events. We'd like to future proof them by, on start up ideally, see which audio events exist. We'd love to avoid having to write additional code or keep track manually which state combinations have audio events.

This way, as our sound engineer adds more sounds for more states, the addition of the events will automatically be triggered by the existing player state logic.

In other words, we'd like to dynamically check which states exist at run time so we can fork logic depending on a given events existence. This lets us write generic code for large sets of possible events, and obviously filter before loading banks or trying to Post an event that may not exist.
 




To elaborate, we may have code that roughly looks like this, for every time a player state changes (for instance, idle => jumping)

```

private void SendWwiseEventEnter() {

string audioEventName = this.CleanedName + "_enter";
Debug.Log("Sending wwise event enter " + audioEventName);
AkSoundEngine.PostEvent(audioEventName, stateMachine.gameObject);

}

```

We'd like to have some logic to filter events before posting, of course - something like this
 

```

private void SendWwiseEventEnter() {

string audioEventName = this.CleanedName + "_enter";
if (
AkSoundEngine.EventExists(audioEventName)) {
    Debug.Log("Sending wwise event enter " + audioEventName);
    AkSoundEngine.PostEvent(audioEventName, stateMachine.gameObject);
}

}

```
A cleaner solution, yet, would be to pull all events at launch and never even call the function for events which would not exist (so we'd manage with our own HashedSet).

I'm sure other projects have approached this, and would love to know the preferred or best found method.

Thanks!

related to an answer for: how to get wwise event list in unity?
asked Nov 13, 2023 in Feature Requests by Lapras Nakamoto (100 points)

Please sign-in or register to answer this question.

...