private static void HandleResponse <T>(string id, ZPCUError error, Func <T> successCallback) where T : class { var callback = _queryCallbacks[id] as Action <T, ZapicError>; if (callback == null) { Debug.LogWarning("Unable to find callback"); return; } _queryCallbacks.Remove(id); //If there is an error if (error.code != 0) { var e = error.ToError(); callback(null, e); } else { Debug.Log("Received a successful response"); var result = successCallback(); Debug.LogFormat("Received result {0}", result); callback(result, null); } }