- Home /
BCE0020: An instance of type 'UnityEngine.WWW' is required to access non static member 'text'.
I am trying to get a line of text from a web page and match it with a line in a .txt file in the game here is the code I have so far import System.IO; var fileName = "version.txt";
var url = "https://googledrive.com/host/0By0eZ3sqrGD2b1FCSDZBamNTZlU/";
function Start ()
{
//read txt file -------------------------------------------------------
var sr = new StreamReader(Application.dataPath + "/" + fileName);
var fileContents = sr.ReadToEnd();
sr.Close();
var lines = fileContents.Split("\n"[0]);
for (line in lines)
{
print (line);
}
//----------------------------------------------------------------------
// read web page---------------------------------------------------------
// Start a download of the given URL
var www : WWW = new WWW (url);
// Wait for download to complete
yield www;
var version = WWW.text;
Debug.Log(version);
//--------------------------------------------------------------------------
}
this code gives me the error BCE0020: An instance of type 'UnityEngine.WWW' is required to access non static member 'text'.
on the line "`var version = WWW.text;`" am I using WWW.text right? there wasent any example code in the manual
Answer by Memige · Nov 19, 2013 at 12:26 AM
Use lowercase 'www', you are currently trying to access the (caps) WWW class
Your answer
![](https://koobas.hobune.stream/wayback/20220613122156im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Is it possible to call a Javascript code on local server from Unity? (Google Chart API involved) 2 Answers
Is there a way to send an XMLHttpRequest and get the response in a WWW object? 0 Answers
Setting Scroll View Width GUILayout 1 Answer
C# Unity function to escape URL querystring parameters 2 Answers