教程视频链接 Tutorial Videos:
YouTube -
Part 1: https://youtu.be/tci13zedrzw
Part 2: https://youtu.be/1vOuh3_ZXRQ
Bilibili -
Part 1: https://www.bilibili.com/video/BV1nQ4y1z7pZ
Part 2: https://www.bilibili.com/video/BV1Cb4y1b71G
The main branch is the initialization version of the tutorial project. You could download it and follow me along with the tutorial video. The completed branch is the final project for references. Feel free to download and use them.
- Two methods to implement data saving and loading in Unity Engine: (1) PlayerPrefs; (2) JSON;
- Their pros and cons
- Build a flexible save system
Main分支的工程文件是教程项目的初始化版本。 你可以使用这个工程跟着我从头开始构建存档系统。 Completed分支的工程文件是教程结束时的完整工程项目,供大家参考。
- 两种Unity引擎中常见的数据存取方法:(1) PlayerPrefs; (2) JSON;
- 它们的优缺点
- 构建一个高适用性的存档系统
PlayerPrefs - Unity Documentation - https://docs.unity3d.com/ScriptReference/PlayerPrefs.html
MenuItem - Unity Documentation - https://docs.unity3d.com/ScriptReference/MenuItem.html
JSON - https://www.json.org/
JSON(中文) - https://www.json.org/json-zh.html
JSON Example - https://json.org/example.html
JsonUtility - Unity Documentation - https://docs.unity3d.com/ScriptReference/JsonUtility.html
JsonUtility.ToJson - Unity Documentation - Scripting API - https://docs.unity3d.com/ScriptReference/JsonUtility.ToJson.html
JsonUtility.FromJson - Unity Documentation - Scripting API - https://docs.unity3d.com/ScriptReference/JsonUtility.FromJson.html
JsonUtility.FromJsonOverwrite - Unity Documentation - Scripting API - https://docs.unity3d.com/ScriptReference/JsonUtility.FromJsonOverwrite.html
Script Serialization - Unity Documentation - Manual - https://docs.unity3d.com/Manual/script-Serialization.html
Application.persistentDataPath - Unity Documentation - Scripting API - https://docs.unity3d.com/ScriptReference/Application-persistentDataPath.html
Path.Combine - Microsoft .NET Docs - https://docs.microsoft.com/en-us/dotnet/api/system.io.path.combine
File.WriteAllText - Microsoft .NET Docs - https://docs.microsoft.com/en-us/dotnet/api/system.io.file.writealltext
File.ReadAllText - Microsoft .NET Docs - https://docs.microsoft.com/en-us/dotnet/api/system.io.file.readalltext
File.Delete - Microsoft .NET Docs - https://docs.microsoft.com/en-us/dotnet/api/system.io.file.delete
try-catch - Microsoft .NET Docs - https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/try-catch