在Unity游戏中保存数据的最佳方法 [英] Best way to save data in Unity game
问题描述
我想知道...在Unity游戏中保存数据的最佳方法是什么. JSON?如果是这样,怎么办?谢谢
I was wondering... What's the best way to save data in Unity games. JSONs? If so, how? Thanks
推荐答案
Here are some of the different Ways and Methods to Save data for Unity Projects:
-
与平台无关::以与平台无关的方式在Unity3D中保存数据的一种方法是使用 1 ,
Platform-Independent: One way of saving data in Unity3D in a Platform-independent way is to use the PlayerPrefs class. (Learn More 1, 2).
持久性-使用 DontDestroyOnLoad , PlayerPrefs 和数据序列化 href ="https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/persistence-data-saving-loading" rel ="nofollow noreferrer">视频教程统一.
服务器端::您还可以使用服务器来保存数据(例如PHP和MySQL数据库的组合).您可以使用它来保存分数数据,用户个人资料等.了解更多信息,请参见 Unity Wiki
Server Side: You can also use a Server for saving data (like combination of PHP and MySQL Database). You can use it to save Score Data, user profile etc., Learn More From Unity Wiki
要以一种可以理解并稍后加载的格式将游戏中数据保存到硬盘,请使用称为 Serialization . 了解详情
For saving the in-game data to a Hard drive in a format that can be understood and loaded later on, use a .NET/Mono feature known as Serialization. Learn More
有关Unity的简单 JSON 指南可在 Unity中获得Wiki 或正式形式,您可以看到 JSON序列化
Simple JSON guide about Unity is available at Unity Wiki or officially you can see JSON serialization
SQLite (an embedded database for your app) is another great option for you get the Free Package, it is simple and easy (and my favorite) if you know SQL.
这篇关于在Unity游戏中保存数据的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!