Reading file from StreamingAssets, Android

Save

public void SaveLevel(string name)
        {
            BinaryFormatter formatter = new BinaryFormatter();
            using (FileStream fs = new FileStream(Path.Combine(Application.streamingAssetsPath, name), FileMode.Create))
            {
                formatter.Serialize(fs, this);
            }
        }

Load

public void LoadLevel(string name)
        {
            string path = Path.Combine(Application.streamingAssetsPath, name);
            byte[] FileBytes;
            if (path.Contains("://"))
            {
                WWW www = new WWW(path);
                FileBytes = www.bytes;
            }
            else
                FileBytes = File.ReadAllBytes(path);
            MemoryStream MS = new MemoryStream(FileBytes);
            BinaryFormatter formatter = new BinaryFormatter();
            LevelInfo LI = (LevelInfo)formatter.Deserialize(MS);
            SetLevel(LI);
        }

So what do I do. I open my own written level editor on Unity, create some levels that gonna be custom afterwards, and save them to StreamingAssets (I serialize a class that consists of arrays and some small vars). Then I build the game and access those files whenever I need.
Everything works fine on PC, but nothing happens on Android platform. I checked File.Exists(path), and it returned false (however I’m not sure if it works correctly on Android).
Path is “jar:file:///mnt/asec/com.Vol4icaGames.WR-1/pkg.apk!/assets/TestLevel”

Some platforms like android do not give you direct access to the streaming assets directory. On android the streaming assets directory is compressed into the apk, and so is not available for you to just read/write files to normally.

It is advised that if you want to save/load files on mobile devices, you should be doing so to the persistantDataPath instead, as you should have no problem reading/writing files to this directory.

It is not possible to access the StreamingAssets folder on WebGL and Android platforms. No file access is available on WebGL. Android uses a compressed .apk file. These platforms return a URL. Use the UnityWebRequest class to access the Assets.