I'm trying to load my image files on android which the images are on JSON. but I can't load any images on android .. In Unity, it is working fine but in Android nothing shows. why? what is the problem??
Here is the code for JSON to ANDROID, is there any incorrect I know there is and my conclusion is the Sprite to load image but how? any ideas?
myfilePath = "jar:file://" + Application.dataPath + "!/assets/TSdatabase.json";
StartCoroutine(GetDataInAndroid(myfilePath));
IEnumerator GetDataInAndroid(string url)
{
WWW www = new WWW(url);
yield return www;
if (www.text != null)
{
string dataAsJson = www.text;
TSGameData myloadedData = JsonUtility.FromJson<TSGameData>(dataAsJson);
myRoundData = myloadedData.myRoundData;
}
else
{
Debug.LogError("Can not load game data!");
}
}
My code to image / sprite for JSON
private void LoadSprite(Sprite sprite) {
MySprite.sprite = sprite;
LoadSprite(MyQuestionImage.questionImage);
}
private void LoadSprite(string path)
{
if (LoadedSprite != null)
Resources.UnloadAsset(LoadedSprite);
LoadedSprite = Resources.Load<Sprite>(path);
MySprite.sprite = LoadedSprite;
}