Hello,
I’m having some issues getting data from particle cloud.To read the data from particle cloud I use WWW class. But there is one problem - the stream of data from particle cloud is infinite, you can see it always updates when the link is opened in the browser and the WWW class returns the data only when it is downloaded. As the stream is endless this data acquisition can’t be done. What could be the solution for this?
For instance, I do not have problems gathering data in this form:
www.ourtechart.com//wp-content/uploads/2016/04/jsonAllData.txt2
In this case working code right now looks like this:
using UnityEngine;
using System.Collections;
public class particle : MonoBehaviour {
string Url = "www.ourtechart.com//wp-content/uploads/2016/04/jsonAllData.txt";
IEnumerator Start()
{
WWW www = new WWW(Url); // Start a download of the given URL (string defined elsewhere)
yield return www; // Wait for download to complete
// http://docs.unity3d.com/ScriptReference/WWW-text.html
if (www.error == null) {
Debug.Log("Service data www: " + www);
Debug.Log("Service data www.isDone: " + www.isDone);
Debug.Log("Service data www.progress: " + www.progress);
Debug.Log("Service data www.text: " + www.text);
Debug.Log("Service data www.bytesDownloaded: " + www.bytesDownloaded );
Debug.Log("Service data www.size: " + www.size );
if (www.isDone && www.error == null) {
Debug.Log("WE'VE GOT DATA!");
}
}
else {
Debug.Log("Error: " + www.error);
}
}
}
As you can see with this example I can acquire data, what’s left - parse the data, which is not the issue.
The script should have the name “particle.cs” and attached to an empty gameObject in Unity3D.
If the String Url will be changed to the particle cloud link with access token we would not get any data as download never ends because of this: “yield return www; // Wait for download to complete”
Anyone has some ideas how to solve this?