Unity中的Json.NET抛出“找不到类型或名称空间`Newtonsoft`" [英] Json.NET in Unity throwing 'The type or namespace `Newtonsoft` could not be found'

查看:499
本文介绍了Unity中的Json.NET抛出“找不到类型或名称空间`Newtonsoft`"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用nuget将Json.NET安装到我的Unity项目中,但是问题是我启动它时抛出 The type or namespace 'Newtonsoft' could not be found. Are you missing a using directive or an assembly reference
但这是我的参考文献,我有using Newtonsoft.Json;
我看过其他问题,但找不到有效的答案.我正在使用Unity 5和最新版本的Json.NET

I used nuget to install Json.NET into my Unity project but the issue is when I launch it throws The type or namespace 'Newtonsoft' could not be found. Are you missing a using directive or an assembly reference
Yet it is in my references and I have using Newtonsoft.Json;
I have looked at other questions but I could not an answer which worked. I am using Unity 5 and the latest version of Json.NET

推荐答案

1 .在Unity中,将Newtonsoft.Json.dll文件放入Assets/Plugins文件夹

1.In Unity, place the Newtonsoft.Json.dll file into the Assets/Plugins folder

2 .在Visual Studio中,在Solution Explorer窗口中突出显示Analyzers.

2.In Visual Studio, highlight Analyzers in the in Solution Explorer window.

3 .转到Project -> Add Reference并选择项目目录,然后选择Assets/Plugin.就是这样.

3.Go to Project-> Add Reference and choose your project directory followed by Assets/Plugin. That's it.

可选:

在Unity 5.3中,Unity添加了Json序列化的原生支持.您可以简单地使用它来转换为Json并返回到class.

In Unity 5.3, Unity added native support of Json serialization. You can simply use that to convert to Json and back to class.

这篇关于Unity中的Json.NET抛出“找不到类型或名称空间`Newtonsoft`"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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