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.

+1 vote
I'm trying to have a callback fire when an event is complete; I can get this to work by passing the Callback() method (seen below) in to PostEvent, but I'd like to be able to pass other delegates in, like the action in the method signature below:

    public override void PlaySound(uint event, GameObject sender, System.Action<object, AkCallbackType, object> callback = null)
    {
        AkSoundEngine.PostEvent(event, sender, (uint)AkCallbackType.AK_EndOfEvent, callback, null);
    }

    private void Callback(object in_cookie, AkCallbackType in_type, object in_callbackInfo)
    {     }

I sort of expected this to work, but I'm getting an error ("cannot convert `System.Action<object,AkCallbackType,object>' expression to type `AkCallbackManager.EventCallback'"). Is this possible? I was unable to find a similar example in the Unity integration demo project, the documentation included in that demo project, or online.

 

edit: Ah, found a solution; you can pass an action in to the constructor for an EventCallback:

AkCallbackManager.EventCallback ec = new AkCallbackManager.EventCallback(new System.Action<object, AkCallbackType, object>((o1,o2,o3) => Debug.Log("Callback")));

AkSoundEngine.PostEvent(eventId, sender, (uint)AkCallbackType.AK_EndOfEvent, ec, null);
in General Discussion by Christopher M. (110 points)
Thanks a lot!

Please sign-in or register to answer this question.

...