在 Unity 游戏中保存数据的最佳方式 [英] Best way to save data in Unity game

查看:52
本文介绍了在 Unity 游戏中保存数据的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道...在 Unity 游戏中保存数据的最佳方式是什么.JSON?如果是这样,如何?谢谢

解决方案

以下是一些为 Unity 项目保存数据的不同方式和方法:

  1. 平台无关:一种以平台无关的方式在 Unity3D 中保存数据的方法是使用

    以上摘自我的关于数据的博文Unity3d 应用程序的保存技巧.

    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:

    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). PlayerPrefs is a static class and it is very easy to use but not reliable.

    2. PERSISTENCE - SAVING AND LOADING DATA using DontDestroyOnLoad, PlayerPrefs, and data serialization Video Tutorial by unity.

    3. Server Side: You can also use a Server for saving data (like a combination of PHP and MySQL Database). You can use it to save Score Data, user profile, etc., Learn More From Unity Wiki

    4. 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

    5. Simple JSON guide about Unity is available at Unity Wiki or officially you can see JSON serialization

    6. SQLite (an embedded database for your app) is another great option for you to get the Free Package, it is simple and easy (and my favorite) if you know SQL.

    7. Scriptable Object: its a data container. Useful for unchanging data. Suitable for large unchaning data and aamazing safe projects memory.

    The above is taken from my blog post on Data Saving Techniques for Unity3d Applications.

    这篇关于在 Unity 游戏中保存数据的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆