How to load text file in this rollover script ? (433803)

is there anyone know how to load text file (ex: foo.txt) in this rollover script…

var rolloverText = “”;
var rolloverColor = Color.red;
private var originalColor : Color;
private var textDisplay : GUIText;

function Start() {
originalColor = renderer.material.color;
if (rolloverText == “”) { rolloverText = “test”;}
textDisplay = GameObject.Find(“Rollover Text Display”).guiText;
}

Please help me, I’m stuck with this…

thanks

You can use System.IO.File.ReadAllText(“yourpath\to\the\foo.txt”);

But that will only work in the standalone non-web builds.

You can also drag a .txt file into your project and access it as a TextAsset.

Thanks for the answer, but I want to use it in web. Is there another way to read txt file.
nb: I using GUIText to display the file

Hi Andeee…sory if i asking again, if i drag .txt file to my project then I can change contain of .txt file from the outside (change contain with my text editor). And if i using GuiText how to implement that way to my script above…
Thanks…

If you want to load in a file from a URL then you can use the WWW class to access it. This also works for local files if you use a file:// URL.

ok, I’ll try to use it first…thanks a lot!

I thought using WWW to load files using the “file://” URL style didn’t work in web-based builds, only standalone it worked. Is that the case?