原文内容来自:Read from and write to external .json files using JsonUtilities or LitJson
文件Unity 版本号5.3,使用时候Unity 版本号5.6
本文仅作分析,学习用途。
_1WriteJSON_basic_LitJson
----------------------------------------------------------------------------------------------原代码+注释
// Transform objects to a JSON-formatted string and save it into a file.
// using LitJson
// basic - without Object arrays
// creating {"name":"Fabi","level":4711,"tags":["Beginner","Fast"]}
using UnityEngine;
using LitJson;
using System.IO;
using System.Collections.Generic;
public class _1WriteJSON_basic_LitJson : MonoBehaviour {
void Start

本文介绍了如何在Unity 5.6版本中使用LitJson库将对象转换为JSON格式并保存到文件。通过示例代码展示了如何创建一个包含姓名、等级和标签的对象,然后将其转换为JSON字符串并保存到Resources目录下的Json_basic.json文件。
最低0.47元/天 解锁文章
1万+

被折叠的 条评论
为什么被折叠?



