public void InvokeCallback()
{
this.SignalWaitHandle();
if (!_callbackInvoked)
{
_callbackInvoked = true;
try {
#if UNITY
if (this.AsyncOptions.ExecuteCallbackOnMainThread)
{
// Enqueue the callback so that the Unity main thread dispatcher
// can invoke the callback on the main thread.
UnityRequestQueue.Instance.EnqueueCallback(this);
}
else
{
// Invoke the callback on current (background) thread
if (this.Action != null)
{
this.Action(this.Request, this.Response,
this.Exception, this.AsyncOptions);
}
}
#else
if(this.AsyncCallback != null)
this.AsyncCallback(this);
#endif
} catch (Exception e)
{
_logger.Error(e, "An unhandled exception occurred in the user callback.");
}
}
}