unity3d - unity StringBuilder Mono 限制

标签 unity3d mono

StringBuilder sb = new StringBuilder();

为什么使用 Mono 时会产生警告?

Mono 限制:序列化格式与 .NET 不兼容

Mac 中的 Unity 5.5.2 和 Visual Studio。

我的英文很差,请理解,谢谢。

最佳答案

简短回答:您可以在自己的 Unity3D 代码中安全地忽略此警告。
更长的答案:在 https://www.mono-project.com/docs/faq/technical/ 的 Mono 技术常见问题解答中有对此警告的解释。 .具体来说,这意味着 Mono 和官方的 MS.NET 实现之间某些类的内部实现是不同的。如果您尝试在 Mono 应用程序中序列化对象(例如,将对象保存在文件中),然后尝试在 .NET 应用程序中读取该对象,这可能会导致问题。
从常见问题解答:

If you are serializing your own classes, there is no problem, since you have control over the assemblies and classes being used for serialization.

However, if you are serializing objects from the framework, serialization compatibility is not guaranteed, since the internal structure of those objects may be different. This compatibility is not even guaranteed between different MS.NET versions or Mono versions.

...

In summary, if you are designing an application that will run in different environments and platforms which are not under your control, and which need to share serialized objects (either using remoting, plain files, or whatever), you must be careful with what objects you share, and avoid objects from the framework when possible.


因此,如果您只是在 Mono 应用程序或 Unity3D 应用程序中的自己的代码中保存和加载对象,那么您可以放心地忽略此警告。

关于unity3d - unity StringBuilder Mono 限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47113537/

相关文章:

c# - 跳跃和记住跳跃时间的问题

C# 使用字符串访问结构

c# - .gitlab-ci.yml for C# 使用 Docker image mono

c# - 如何在 Mono 和多个平台上使用 X509Certificate2 正确验证 SSL 证书

node.js - azure-functions-cli : func init spits error "No such file or directory"

c# - 虽然我可以在方法中更改自定义对象的属性,但我无法更改 Vector3(Unity、C#)的属性

c# - Unity MissingReferenceException 第二次加载相同场景时

c# - Unity 5.3 - C# -- List<Vector2> 如何提取最大的 X 值?

mono - 无法打开 MonoDevelop v 2.4.2

mono - gtk# Mono 中的 gdk.Pixbuf 问题