Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Json.Net to a Unity3D project

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.

like image 711
KonfuPanda Avatar asked May 22 '15 13:05

KonfuPanda


People also ask

Can you use Json NET with Unity?

NET ecosystem. But it doesn't support Unity3D, so it's a little bit hard to use JSON.NET just after getting Json.NET package. This package is for Unity3D programmers that need to use latest Json.NET in Unity3D. Just import the unity package and you are good to go.

How do I add Newtonsoft to unity project?

If you want the newtonsoft package that Unity is using you can simply go into the package manager click the + then from git url and fill in "com. unity. nuget.

Is Newtonsoft Json included in unity?

This is a package intended for internal Unity Development Projects and as such this package is not supported.


1 Answers

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.

Add reference in Visual Studio 2015 part 1 Add reference in Visual Studio 2015 part 2

like image 116
KollKode Avatar answered Oct 20 '22 14:10

KollKode