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);