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 to use Event Callbacks with the Unity Integration?

–1 vote
Trying to figure out how to translate this info into C# so that we can use event callbacks with the Unity Integration:  http://kb.gowwise.com/questions/174/How+can+I+be+notified+when+an+event+has+finished+playing%3F

If anyone has an example of how to use them, that would be rad.  Essentially I'm just trying to find out when an event has finished and use that to trigger further actions.
asked Sep 26, 2014 in General Discussion by Joel G. (190 points)
edited Sep 29, 2014 by Bernard R. (Audiokinetic)

1 Answer

0 votes

There is an example of using a callback in the Unity Integration Demo project.  Check the MarkerCallback scene.  But in short, it works the same way as in C++.  For example:

AkSoundEngine.PostEvent("MyEvent", gameObject, AK_EndOfEvent, MyCallbackFunction, myCookieObject);

void MyCallbackFunction(object in_cookie, AkCallbackType in_type, object in_info)

{

if (in_type == AK_EndOfEvent)

{

   AkEventCallbackInfo info = (AkEventCallbackInfo)in_info; //Then do stuff.

}

}

You can find more info in the Unity doc that comes in the Unity package, or in the AkCallbackManager class, or in the SDK doc (comes with the Wwise installation).  Also note we have another Unity demo project for the 2014.1 version that also demonstrate the use of callbacks.  Check it out!

answered Oct 1, 2014 by Mathieu J. (Audiokinetic) (7,120 points)
Thanks for the reply Mathieu, we have it working now :)
I see the subtitle demo in the "Wwise Unity 5 Demo Scene" but I don't see a MakerCallback scene or a Unity Integration Demo anywhere. Am I missing it? Do any of these Unity integration demonstrate Midi callbacks?
...