原文内容来自:Read from and write to external .json files using JsonUtilities or LitJson
文件Unity 版本号5.3,使用时候Unity 版本号5.6
本文仅作分析,学习用途。
_3WriteJson_ObjectArray_LitJson
----------------------------------------------------------------------------------------------原代码+注释
// Transform objects to a JSON-formatted string and save it into a file.
// using LitJson
// storing nested objects in array
// creating {"highscore":[{"name":"MagicMike","scores":8828},{"name":"MadMax","scores":4711}]}
using UnityEngine;
using LitJson;
using System.IO;
using System.Collections.Generic;
public class _3WriteJson_ObjectArray_LitJson : MonoBehaviour