I have completed the Unity Quiz tutorial:
https://www.youtube.com/playlist?list=PLX2vGYjWbI0QvcZNfQaJ3efswYoDmaQWX
With intent of using it as a basis for an Android Quiz game using mechanics similar to that of tinder/reigns where you will swipe Right or left for an answer being true or false.
This tutorial uses a json file to store Question and Answer data, which works successfully within the unity editor however does not work when deploying the game to an Android device.
I need some help resolving this issue so that my game can load the questions and answers successfully from an android device.
I am open to suggestions using an alternative method to json for storing this data, Any help resolving this would be appreciated.
I have done background research and I understand that using json in Android is difficult due to the StreamingAssets folder being zipped. This can be overcame through the WWW feature in unity, I believe, but I dont quite understand it.
I found someone with a similar problem in this feed here, but the answer is not very clear at all. If you are able to understand how their problem was resolved, it would be great if you could explain.
All of the code can be found on the Unity website here: https://unity3d.com/learn/tutorials/topics/scripting/question-and-answer
But the main bit is within the DataController class with the Load function.
private void LoadGameData()
{
string filePath = Path.Combine(Application.streamingAssetsPath, gameDataFileName);
if (File.Exists(filePath))
{
string dataAsJson = File.ReadAllText(filePath);
GameData loadedData = JsonUtility.FromJson<GameData>(dataAsJson);
allRoundData = loadedData.allRoundData;
}
else
{
Debug.LogError("Cannot load game data");
}
}
Would really appreciate any help in getting this working within android. I know this is kind of a duplicate question however I don't feel it has been resolved in a way that is easy to comprehend for beginners.
Thanks again.