Search Unity

[Web] Reading local file

Discussion in 'Scripting' started by Sbizz, Mar 27, 2015.

  1. Sbizz

    Sbizz

    Joined:
    Oct 2, 2014
    Posts:
    250
    Hey.

    I have a project that we want to be cross-platform. Everything works on Windows, Mac, etc.

    I tried to launch it on the Web Player, but it seems that System.IO.File doesn't work on this platform.

    I was wondering how I can read a local text / binary file through the Web Player ?

    I need to do that because when the player clicks on "Log in", we load all the language files stored in a directory. Do you have any idea how I can do that ? I would like to NOT use WWW.. (the files are read from a DLL that can be used with different kind of client).

    Thank you!
    Sbizz.
     
  2. Glockenbeat

    Glockenbeat

    Joined:
    Apr 24, 2012
    Posts:
    669
  3. Sbizz

    Sbizz

    Joined:
    Oct 2, 2014
    Posts:
    250
    Yeah, I read this post.

    I'm thinking about using Resources. But this class only exists because of Unity, so I can't use it in a DLL. I'm gonna make an interface and see what I can do.
     
  4. Glockenbeat

    Glockenbeat

    Joined:
    Apr 24, 2012
    Posts:
    669
    Your project is executed on the client side, not on the server, which means you cannot read from the directory on the server. You have to use some kind of web mechanisms to load the stuff and since you are talking about language files I strongly recommend a combination of a Rest API and JSON data which is sent to your client (meaning WWW).