将 Json.Net 添加到 Unity3D 项目 [英] Adding Json.Net to a Unity3D project

查看:64
本文介绍了将 Json.Net 添加到 Unity3D 项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过 NuGetpackage 将 Json.Net 库添加到 Visual Studio 2013 并为 NetFramework 4.5 安装了它.添加

时,我在 Visual Studio 中没有收到错误消息

使用 Newtonsoft.Json;

但在 Unity3D 5.0 中出现错误:

<块引用>

Assets/RobotController.cs(5,7):错误 CS0246:类型或命名空间找不到名称Newtonsoft".您是否缺少使用指令或程序集引用?

我在这个项目的包文件夹中查找了 dll 文件,所以我不明白问题所在.感谢帮助.

解决方案

我在 Visual Studio 2015 中遇到了同样的问题.但是

I added the Json.Net library to Visual Studio 2013 via NuGetpackage and installed it for NetFramework 4.5. I don't get an error in Visual Studio when I add

using Newtonsoft.Json;

but in Unity3D 5.0 I get the error:

Assets/RobotController.cs(5,7): error CS0246: The type or namespace name `Newtonsoft' could not be found. Are you missing a using directive or an assembly reference?

I looked up in my packages folders for this project and the dll file is there, so I don't understand the problem. Thx for help.

解决方案

I had just the same problem in Visual Studio 2015. But Utamaru's solution worked for me.

Make a folder: Assets/Plugins where you put the *.dll file and add it as a reference.

To add a reference you highlight the Analyzers in the Solution Explorer in Visual Studio and under Project > Add Reference you can find your *.dll file located in Assets/Plugin by browsing to it.

这篇关于将 Json.Net 添加到 Unity3D 项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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