- Home /
How do you load a file using the WWW class?
I'm trying to load a JSON file using the WWW class into unity for parsing and I cannot figure out how to load it in. I'm using any .js examples would be great. Thanks.
Comment
Best Answer
Answer by Dave-Carlile · Dec 27, 2012 at 08:17 PM
If you're trying to load a local file, use the file:\\\\ protocol, e.g. "file:\\\\c:\\some_folder\\myfile.json".
The WWW documentation has an example as well that should show you what you need to do. Their example shows loading a texture and using the WWW.texture property to access it. There are other properties for different types of data. You're likely interested in the WWW.text property.