googleanalytics / google-analytics-plugin-for-unity

Google Analytics plugin for the Unity game creation system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unneeded control flow in HandleWWW coroutine

belm0 opened this issue · comments

From my understanding, yielding a WWW object will not return until the request is complete. The outer while loop and request.isDone test in HandleWWW aren't needed.

 public IEnumerator HandleWWW(WWW request)
 {
   while (!request.isDone)
   {
     yield return request;
     ...

(I'm interested in this area of the code, trying to find a way to achieve a best-effort flush of pending HTTP requests on Unity shutdown. I think it may require a coroutine wrapper that can synchronously exhaust the enumerator...)

Actually there's a race condition as well-- request-done code (just logging currently, so rather harmless) would not get executed if the request finished (failed fast somehow?) before HandleWWW gets it.