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.

Bug: AkEvent and AkState IDs are being reassigned which messes up Unity Scenes/Prefabs.

+2 votes

Unity 2017.3.0p4
Wwise Integration 2017.2.1.6524.980

After our sound designer changes the Wwise project and generates updated SoundBanks, we sometimes get mismatching references in Wwise Components in Unity. Components like AkState and AkAmbient serialize references to SoundBank data like Events and States as int values that are mapped via a custom Inspector implemented in AkBaseInspector and inheriting classes AkEventInspector and AkStateInspector.

This boils down to a MAJOR issue and a MINOR issue for using Wwise for Soundbanks with Events and States:

  • Major issue: Wwise Editor apparently reassigns Event and State IDs. This should never be the case for them to be reliably referenced from Unity side.
  • Minor issue: In Unity, custom Inspector code runs UpdateIds method, which can rewrite the eventID and State m_groupID/m_valueID fields. This makes it really confusing when first audio breaks while testing, then suddenly it has been fixed and you've just wasted hours debugging and trying to make changes in both Wwise and Unity. It took me a full evening to even figure out that it's Inspector GUI code that just "fixed" my problem by rewriting the outdated references to something new. And I still don't know how the GUI code worked out which is the correct new ID, if the old ID was out-of-date and unreferenceable in the first place.

AkEvents have a serialized field named "eventID".

AkStates have serialized fields named "m_groupID" and "m_valueID".

When you select an Event or State via Wwise Picker UI tool, the Inspector saves the reference via a numerical ID into eventID for AkEvents (for instance AkAmbient to play music by posting an Event on Start) or m_groupID and m_valueID for AkState (for instance to send a State to alter music sub-state in a multi-piece songs). These saved values MUST be the same for the data in the Wwise-generated soundbank data files and in the aforementioned Unity Components which have their data (the selected events and states to play) saved as part of Scene files or Prefabs inside Unity project.

There seems to be something wrong with the Unity Integration or the Wwise Editor generating the soundbanks in the latest version, since for us Wwise is reassigning the Event/State IDs when the banks are generated and the Wwise project is saved, instead of maintaining the same, reliable ID for the same Event etc. This creates a mismatch between the Wwise soundbanks and the IDs serialized by audio Components in Unity.

Now when our sound designer changes pretty much anything in Wwise, all Scenes that have AkAmbient Components in them to play music produce this error, breaking all music in the project:

Error 1:

Could not post event ID "1239046959". Did you make sure to load the appropriate SoundBank?
UnityEngine.Debug:LogError(Object)
AkEvent:HandleEvent(GameObject) (at Assets/Wwise/Deployment/Components/AkEvent.cs:86)
AkAmbient:HandleEvent(GameObject) (at Assets/Wwise/Deployment/Components/AkAmbient.cs:116)
AkUnityEventHandler:Start() (at Assets/Wwise/Deployment/Components/AkUnityEventHandler.cs:55)

Error 2:

Wwise: Event ID not found: 1239046959 (GameObject: Ambient (UnityEngine.GameObject)) (Instance ID: 18446744073709245984)
UnityEngine.Debug:LogError(Object)
AkCallbackManager:PostCallbacks() (at Assets/Wwise/Deployment/API/Handwritten/AkCallbackManager.cs:309)
AkSoundEngineController:LateUpdate() (at Assets/Wwise/Deployment/Components/AkSoundEngineController.cs:78)
AkInitializer:LateUpdate() (at Assets/Wwise/Deployment/Components/AkInitializer.cs:113)

Wwise Unity Integration's Component Inspectors seem to be able to fix and update the integer references to IDs, but that is useless for workflow and time reasons: it clearly shouldn't be the case that every time you make a change in the Wwise project everything needs to be setup again in Unity project for every Scene and GameObject/Prefab that plays sound, even if the per-object fix is as simple as selecting the GameObject with AkAmbient/AkState Component on it so it's custom Inspector will automatilly call UpdateIds method and reset these values to what the changed Ids are in the generated Wwise soundbank data. I think these IDs should remain consistent if you only change transitions/volumes and configurations in Wwise project, that don't explicitly remove and rename Events and States.

Here are screen captures of AkAmbient and AkState Components automatically modifying the serialized fields when switching to Normal Inspector from Debug, and the Wwise custom AkBaseInspector.UpdateIds method is run:

Now, we have AkAmbient Components set up in many level Scenes, and will have some references to Ak.Wwise.Event/Ak.Wwise.State in our own scripts too, and we can't simply edit every sound-emitting object after sound design changes and rebalances over and over again.

Questions:

  1. What can we do as a short-term solution to our workflow to avoid repetitive ID changes in Unity?
  2. Does anyone know if there's a possible misconfiguration/gotcha/trick we may have missed when setting up the integration that would cause this kind of confusing ID mismatching? It still seems to me that Wwise should not logically reassign IDs to something that already has an ID, so it would be logical for it to be a mistake on my end.
  3. Is there something wrong with the latest Wwise Integration update, since we are running quite a fresh version?
asked Feb 12, 2018 in General Discussion by Kimmo K. (400 points)

3 Answers

0 votes
Really hoping to hear some sort of official answer on this too... it's been an absolute nightmare managing this.
answered Apr 15, 2018 by Haven M. (190 points)
0 votes
This shouldn't be happening for sure. "Refresh project" in Wwise picker doesn't help?
Have you tried using soundbank names instead of ID's? https://www.audiokinetic.com/library/edge/?source=Help&id=defining_soundbank_project_settings
answered Apr 24, 2018 by Tobias D. Nielsen (2,450 points)
0 votes
Same problem too! Every time I generate again soundbanks I miss all the events in Unity  (using Ak ambient and Ak event). Why is this happening?

I tried to refresh project but nothing happens.

Also if I try to override prefabs containing the same audio events is not working for me.

PLEASE HELP!!!!!
answered Mar 17, 2022 by Leonardo L. (140 points)
...