JSON.net 导入 XBox Live 服务后出错
JSON.net error after importing XBox Live services
我已将 XBox Live Unity asset package 添加到我的项目中,但在 Unity 中出现此错误。奇怪的是,它没有在 Visual Studio 中显示,但它阻止我使用 运行 我的应用程序。
error CS7069: Reference to type `System.ComponentModel.INotifyPropertyChanging' claims it is defined assembly `System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', but it could not be found
错误所指的行如下
JObject response = JsonConvert.DeserializeObject( request.text ) as JObject;
请求是一个 Unity WWW
对象。
我在我的应用程序中使用了 this asset package,但我删除了它,因为它看起来像 XBox Live 已经包含一个预编译的 dll?
看来 JObject
是问题所在。更改为 JContainer
即可解决问题,无需进一步更改代码
JObject
class在Json.NET中定义为:
public partial class JObject : JContainer, IDictionary<string, JToken>, INotifyPropertyChanged
而 JContainer
定义为:
public abstract partial class JContainer : JToken, IList<JToken>
当您使用 JObject 时,Unity 期望能够找到 INotifyPropertyChanged
实现,但它似乎找不到。
我的第一个假设是 class 在 .NET 2.0 子集中不存在,但我已经验证(在 Unity 5.5 中)它可用。您能否提供更多详细信息,让我知道您使用的是哪个版本的 Unity?
我已将 XBox Live Unity asset package 添加到我的项目中,但在 Unity 中出现此错误。奇怪的是,它没有在 Visual Studio 中显示,但它阻止我使用 运行 我的应用程序。
error CS7069: Reference to type `System.ComponentModel.INotifyPropertyChanging' claims it is defined assembly `System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089', but it could not be found
错误所指的行如下
JObject response = JsonConvert.DeserializeObject( request.text ) as JObject;
请求是一个 Unity WWW
对象。
我在我的应用程序中使用了 this asset package,但我删除了它,因为它看起来像 XBox Live 已经包含一个预编译的 dll?
看来 JObject
是问题所在。更改为 JContainer
即可解决问题,无需进一步更改代码
JObject
class在Json.NET中定义为:
public partial class JObject : JContainer, IDictionary<string, JToken>, INotifyPropertyChanged
而 JContainer
定义为:
public abstract partial class JContainer : JToken, IList<JToken>
当您使用 JObject 时,Unity 期望能够找到 INotifyPropertyChanged
实现,但它似乎找不到。
我的第一个假设是 class 在 .NET 2.0 子集中不存在,但我已经验证(在 Unity 5.5 中)它可用。您能否提供更多详细信息,让我知道您使用的是哪个版本的 Unity?