Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

0 votes

Hey everyone,

I'm using Wwise 2024.1.6.8842.3614 with Unity 6000.0.47f1.
I'm having an issue that I've seen discussed but never properly solved before: the soundengine itself works perfectly and I can play music, sound effects, etc. . But as soon as I add a "AkGameObj" component to any GameObject for spatial audio, I get spammed with the error message "Wwise: Unknown/Dead game object ID used in function SetPosition. Make sure the game object is registered before using it and do not use it once it was unregistered.". 

I've been pulling my hair out over this debugging the readable C# part of Wwise, trying to register the GameObject manually before it gets enabled, trying different script execution orders, trying to find wwise events that fire once the sound engine is initialized, etc. and I've found one slightly convoluted solution that makes me scratch my head which is why I wanted to share it while also asking why it's not documented anywhere and whether I'm getting something wrong:

If I don't add an AkGameObj component to the respecitive GameObject but instead attach a script that adds the component after one frame, everything seems to work fine and I don't get any errors with spatial audio properly doing its thing. Here's the code that works:

    private void Awake()
    {
        StartCoroutine(AddAkGameObjDelayed());
    }

    private IEnumerator AddAkGameObjDelayed()
    {
        yield return new WaitForEndOfFrame();
        gameObject.AddComponent<AkGameObj>();
    }

Why does this happen and why is adding the AkGameObj component like this necessary? The soundengine claims to be initialized but the fact that this works while just adding the AkGameObj directly in the editor spams me with errors, tells me that the Wwise initialization process does something under the hood that takes longer than one frame.

Thank you for your help

in General Discussion by Alexander Loosen (100 points)

Please sign-in or register to answer this question.

...