Hi,
I’m having problems with yield: “yield return request;” never returns on Android device of my customer. I looked for existing answer, but couldn’t find any useful hints.
using UnityEngine;
using System.Collections;
public class TestConnection : MonoBehaviour {
// Use this for initialization
void Start ()
{
StartCoroutine(Test());
}
IEnumerator Test()
{
string tag = "Test";
Debug.Log("Test connection: " + tag);
string url = "http://search.twitter.com/search.atom?lang=en&q=%23" + tag;
WWW request = new WWW(url);
Debug.Log("Created request");
// Wait for download to complete
yield return request;
Debug.Log("Done request. Error: " + (request.error != null ? request.error : "NoError"));
Debug.Log("request.text: " + request.text);
GetComponent<Text2D>().text = request.text.Substring(0, 50);
Debug.Log("Set text");
}
}
I just prints: “Test connection: Tag” and “Created request” and then just sits there.
Any ideas?
@Bovine: certainly "request" is being used, that's what "yield return request" is doing, as well as the actual results, namely request.text. Yield return null just waits a frame, which isn't useful at all in this case.
– Eric5h5(looks like UnityAnswers ate your formatting... please reformat...)
– SisterKyIt's weird that format breakage happens sometimes. I just edited, added a blank line and saved. Odd.
– WazIt's conceivable that on your Android device there is something wrong with networking (so the request never completes). Does it all work fine in the editor?
– WazIt works fine in the editor. The Android device can open same link in a browser.
– Paulius-Liekis