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