protected virtual void Dispose(bool disposing) { if (disposed) { return; } if (disposing) { unityWebRequest.Dispose(); unityWebRequest = null; ErrorReceived.RemoveAllListeners(); ErrorReceived = null; DownloadInProgress.RemoveAllListeners(); DownloadInProgress = null; DownloadCompleted.RemoveAllListeners(); DownloadCompleted = null; ExceptionCaught.RemoveAllListeners(); ExceptionCaught = null; } disposed = true; }
/// <summary> /// Initializes a new instance of the <see cref="UnityHttpClient"/> class. /// </summary> public UnityHttpClient() { ErrorReceived = new ErrorReceivedEvent(); DownloadInProgress = new DownloadInProgressEvent(); DownloadCompleted = new DownloadCompletedEvent(); ExceptionCaught = new ExceptionCaughtEvent(); unityWebRequest = new UnityWebRequest(); AutoDispose = true; }