Exemplo n.º 1
0
 public UnityWebClient GetClient()
 {
     if (_client == null)
     {
         _client        = new UnityWebClient(this);
         _clientLastUse = DateTime.UtcNow;
     }
     return(_client);
 }
Exemplo n.º 2
0
        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.");
            }
        }