Method Access Exception

Hi,

I have been quite new to Unity. I am trying to build a grammar app as a project. What my project does is, it basically reads a text file. After reading the text file it parses these sentences. Each time it brings the full sentence which has 4 words and you need to find the noun. When you find the noun, it brings the next sentences. Every words is set on a button. When you click the right button, it goes to next. I want to run this app on the web. I have built the app for web. When i run the app on the browser, it brings the default for 4 to set the game then it goes blank when you click the noun. When i run the app on unity, it works. Any help would be really appreciated.

Thanks

Remzi.

What is the exact exception you are getting? On which platform do you have problems? How are you loading the text file? Do you include the text file in Unity? If so, where exactly do you have it?

It is private/protected method exception i was getting then i made everything public but it still does not work. It does not on the browser. I read the file with Streamreader method. I have included the text file inside the unity project in my folder. I do not know where should i put the text file ?

What is the exact error message?
Are you creating a web player?

Please show the code with which you are loading the file and creating the stream to read it. Please use code tags:
http://forum.unity3d.com/threads/using-code-tags-properly.143875/

Here is the code i am reading the text file.

string text;
        string file = @"C:\Unity Project\English App\nouns.txt";
        StreamReader fileReader = new StreamReader(file,Encoding.Default);
        text = fileReader.ReadToEnd();
        string[] lines = Regex.Split (text,"\r\n");

I haven’t created a webplayer. I am not sure how to do that.

On which platform are you trying to run it?

I am trying to run it on Unity Web Player.

You can’t use a StreamReader in the Web Player because of security reasons. You have to use WWW instead:

And it is important to note that:

When I use www, where should i put my text file? How should i give url which points that text file? I am quite confused to be honest. I have tried to use www but does not run at all.

The main question for me is, what are you trying to achieve? Do you want to create the game for the web player? Do you want to be able to update those text files without updating the application?

Basically what i want to achieve is that, i want to just read the text file and put the sentences into the buttons. I don’t want to update the text file at the moment. If i want to extend the game in the future, it will be a update to the text file which will be done by manually. I need to read this file and use the information while i play this game on the web browser.