- Home /
Question by
domraGames · Apr 21, 2020 at 09:42 AM ·
texthttp
Show text from txt file from http
Hello guys, i have a Problem that my code works in the unity build. But when I test it on smartphone it won't show the text. When I change the url to a https url txt file it works. I think the smartphone won't show txt from http. How can I show even http txt on smartphone? Here is my code:
public Text textFromWWW;
void Start()
{
StartCoroutine(GetTextFromWWW());
}
IEnumerator GetTextFromWWW()
{
UnityWebRequest www = UnityWebRequest.Get("http://....txt");
yield return www.SendWebRequest();
if (www.isNetworkError || www.isHttpError)
{
Debug.Log(www.error);
}
else
{
// Show results as text
textFromWWW.text = www.downloadHandler.text;
}
}
Comment
Your answer

Follow this Question
Related Questions
Read text from http 2 Answers
Help with making a triggered gui message 1 Answer
Break the limits on text area 0 Answers
Unity crashes at writing TextMesh? 0 Answers
The variable m_Font of 'GUISkin' doesn't exist anymore 1 Answer