yield return WWW.text not downloading???

Basically i’m doing a simple username and password script from a mysql database but when i get the data then it keeps giving me a strange error:
UnityException:

WWW is not ready downloading yet
UnityEngine.WWW.get_text () (at C:/BuildAgent/work/d63dfc6385190b60/artifacts/EditorGenerated/Utils.cs:171)
    DatabaseLoginManager+<Start>c__Iterator0.MoveNext () (at Assets/DatabaseLoginManager.cs:31)

I don’t see the issue, here’s my code:

using UnityEngine;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
public class DatabaseLoginManager : MonoBehaviour {
	public string url;
	public string username;
	public string password;
	public UnityEngine.UI.InputField usernameInput;
	public UnityEngine.UI.InputField passwordInput;
	public WWW www;
	public string UserAndPass;
	// Update is called once per frame
	public GameObject ErrorMesage;
	void Update () 
	{	
		username = usernameInput.value;
		password = passwordInput.value;
		if(Input.GetKeyDown(KeyCode.Return))
		{
			url = "http://tgsfps.x10host.com/GAMEDB/TGSFPS/Retrieve.php?username=" + username;
			UserAndPass="User="+username+"-"+"Pass="+password;
		}
		username = usernameInput.value;
		password = passwordInput.value; 
	}

	IEnumerator Start()
	{
		WWW www = new WWW (url);
		yield return www.text;
		UserPassCheck ();


	}

	void UserPassCheck()
	{

	}


}

(This relates to the revised code)

The update function is looking at the member field www, which is

a) never being set (your Start function sets a local www variable instead - this is what fafase’s comment is hinting at)

and

b) not being checked in Update to see if it’s returned.

I would probably

  1. remove the WWW member variable altogether,

and

  1. put the code that processes the returned WWW object in the function that calls it (ie after the “yield return www”).

That way you know you’re only ever processing the WWW object after it’s returned. Best to check that it’s succeeded before using www.text, too.