File path in IOS and Android for distribution

Exactly what @Adrian says above. Here is how to get the path:

    // alas it seems that Unity apparently still requires us to know this...
    // reference: https://docs.unity3d.com/Manual/StreamingAssets.html
    static string StreamingAssetPathForReal()
    {
        #if UNITY_EDITOR
        return "file://" + Application.dataPath + "/StreamingAssets/";
        #elif UNITY_ANDROID
        return "jar:file://" + Application.dataPath + "!/assets/";
        #elif UNITY_IOS
        return "file://" + Application.dataPath + "/Raw/";
        #endif
    }

NOTE: for Android it is often necessary to open the file as above, then read it and write the data back into a regular file located here:

That file will be accessible to things like MySQL that cannot access things through the streaming assets interface. It means that if you have a 50mb database in your APK, you now have to copy it out and write it to another place on the user’s phone, requiring yet another 50mb of space, which kinda sucks, but that’s what we get for digitally-signed assets like APKs.

2 Likes