- Home /
WWW download in background during position animation
Is it possible to have WWW not freeze up the entire Unity app, i.e., have the download happen "in the background", while a gameobject animation is being carried through?
I would love to know the answer to this, as I'm having the same problem now.
The answer may be this (but it required PRO): http://docs.unity3d.com/Documentation/ScriptReference/Application.LoadLevelAsync.html
@sfbaystudios i don't think LoadLevel has anything to do with WWW...
Answer by nventimiglia · Dec 03, 2012 at 08:35 PM
Put it in a coroutine. Here is a segment from my VersionCheck script.
public IEnumerator CheckVersion()
{
Busy.SetActive(true);
yield return 1;
if (Application.internetReachability == NetworkReachability.NotReachable)
{
DoFail(string.Format(ErrorMessage, "Internet not reachable"));
yield break;
}
var www = new WWW(ApiUrl);
yield return new WaitForSeconds(1);
yield return www;
yield return 1;
var v = www.text.Replace("\"", "");
if (!string.IsNullOrEmpty(www.error))
{
DoFail(string.Format(ErrorMessage, www.error));
}
else if (Version != v)
{
DoFail(string.Format(FailMessage, v));
}
else
{
Close();
}
}
@nventimiglia are you able to get WWW to download content as something else is animating?
Yes. Put the animation start / stop at the begining and end of the routine.
Answer by infinitypbr · Dec 07, 2012 at 09:33 AM
I asked a very similar question, and it's all working now.
That is here: http://answers.unity3d.com/questions/358059/wwwprogress-failing-with-object-reference-not-set.html