There is the following code to read the file:

public void readPurchase(){ string path; #if UNITY_EDITOR path = "/StreamingAssets/purchase.json"; #elif UNITY_ANDROID path = "jar:file://" + Application.dataPath + "!/assets/purchase.json"; #endif StartCoroutine (jsonReadCorout(path)); string json = File.ReadAllText(Application.dataPath + path); itemsContent = JsonUtility.FromJson<Main> (json); bundleForPing = itemsContent.bundleID; } IEnumerator jsonReadCorout(string path){ WWW www = new WWW(path); yield return www; { Debug.LogError ("Can't read"); } } 

the file is in the folder StreamingAssets, I have not the right path to it but I can not understand where the error.

    1 answer 1

    Everything just turned out ...

     private IEnumerator ReloadFile(){ WWW data = new WWW(Application.streamingAssetsPath+"/"+"purchase.json"); yield return data; itemsContent = JsonUtility.FromJson<Main> (data.text); bundleForPing = itemsContent.bundleID; } 

    File purchase.json need to be placed in the folder StreamingAssets .