I need WWW to reload information

I call a file that works as a news feed from the web using WWW and load it into a GUILayout.Label but I need this file to reload/refresh. I would like for it to preferably be a pull down function like twitter but if that isn’t possible, any reload/refresh feature would be great!

using UnityEngine;
using System.Collections;
[ExecuteInEditMode()]

public class news : MonoBehaviour {
	public string myNews;


	public string url = "https://feed.txt";
	IEnumerator Start() {
		WWW guiwww = new WWW(url);
		yield return guiwww;
		myNews = guiwww.text;

	}

	void OnGUI()
	{

			GUILayout.BeginArea(new Rect(0,Screen.height-Screen.height/4*3,Screen.width,Screen.height/3*2));
			scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(Screen.width-10), GUILayout.Height(Screen.height/3*2));
			GUILayout.Label(myNews);
			GUILayout.EndScrollView();
			GUILayout.EndArea();

	}
}

thanks for all future help!

You need to make your text download into a separate coroutine form Start() and then call it as you will:

using UnityEngine;
using System.Collections;
[ExecuteInEditMode()]

public class News : MonoBehaviour {

	public string url = "https://feed.txt";;
	private string myNews;
	private Vector2 scrollPosition = new Vector2(0,100);

	void Start() {
		StartCoroutine(LoadText());
	}

	IEnumerator LoadText() {
		WWW guiwww = new WWW(url);
		yield return guiwww;
		myNews = guiwww.text;
		
	}
	
	void OnGUI()
	{
		if (GUI.Button(new Rect(0,0,100,50), "Reload")) {
			StartCoroutine(LoadText());
		}
		GUILayout.BeginArea(new Rect(0,Screen.height-Screen.height/4*3,Screen.width,Screen.height/3*2));
		scrollPosition = GUILayout.BeginScrollView(scrollPosition, GUILayout.Width(Screen.width-10), GUILayout.Height(Screen.height/3*2));
		GUILayout.Label(myNews);
		GUILayout.EndScrollView();

		GUILayout.EndArea();
		
	}
}

Judging by the comment thread above, the solution is to make another WWW call whenever you want an updated version of the file. Once you download the file, that’s it - it’s not linked to the site you downloaded it from in any way, and it won’t be updated if the site changes.

You could do something like a coroutine loop to download a new file every X seconds and overwrite the existing file. E.g.:

IEnumerator updateFile()
{
  while(true)
  {
    WWW guiwww = new WWW(url);
    yield return guiwww;
    myNews = guiwww.text;
    yield return new WaitForSeconds(30f); //download every 30 seconds
  }
}