Reputation: 47
I want to get whole HTML code to get some data from web in Unity. I checked the Unity documents, and I followed the example which is written in Unity doc. But all I can get is These Logs.
<!DOCTPYE HTML>
<html>
Is there any way to get a whole HTML Code in Unity? This is my code.
using UnityEngine;
using System.Collections;
using UnityEngine.Networking;
public class MyBehaviour : MonoBehaviour {
void Start() {
StartCoroutine(GetText());
}
IEnumerator GetText() {
UnityWebRequest www = UnityWebRequest.Get("https://gunwoo7.github.io/My_blog/Test.html");
yield return www.SendWebRequest();
if(www.isNetworkError || www.isHttpError) {
Debug.Log(www.error);
}
else {
// Show results as text
Debug.Log(www.downloadHandler.text);
// Or retrieve results as binary data
byte[] results = www.downloadHandler.data;
}
}
}
Upvotes: 1
Views: 569
Reputation: 90724
You content is already there!
In the log Console Window Unity by default only displays the first two lines of each message.
But if you click on it you will see the complete message in the lower part of the console (Test
just executes your exact code):
You can also adjust this and display more then the two lines (up to 10) via
so now you can see all (up to 10) lines at once
Upvotes: 1