Beispiel #1
0
    /// <summary>
    /// Reads the answers json and stores them into text assets.
    /// </summary>
    List <Snippet> ReadAnswers()
    {
        AnswerData loadedData = new AnswerData();
        string     filePath   = Path.Combine(Application.streamingAssetsPath, "Answers.json");

        Debug.Log("Path:" + filePath);
        if (File.Exists(filePath))
        {
            string dataAsJson = File.ReadAllText(filePath);
            loadedData = JsonUtility.FromJson <AnswerData>(dataAsJson);
        }
        else
        {
            Debug.LogError("Cannot find file!");
        }

        return(loadedData.ConvertToAnswers());
    }