public UnityWebClient GetClient() { if (_client == null) { _client = new UnityWebClient(this); _clientLastUse = DateTime.UtcNow; } return(_client); }
public virtual void OnUpdate() { var client = _client; if (client != null && DateTime.UtcNow - _clientLastUse > MaxUnusedLifespan && !client.IsBusy) { _client = null; client.Dispose(); Logger.Current.Debug("Disposing WebClient because it was not used for 20 seconds."); } }