Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Json.NET in Unity throwing 'The type or namespace `Newtonsoft` could not be found'

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

like image 476
Walshy Avatar asked Jun 28 '16 18:06

Walshy


People also ask

Can I use Newtonsoft JSON in unity?

The package is not supported by Unity as in if there are problems with the actual functionality of newtonsoft json, Unity won't help you with that. Because it is a third party library.

What is the use of Newtonsoft JSON DLL?

The Newtonsoft. JSON namespace provides classes that are used to implement the core services of the framework. It provides methods for converting between . NET types and JSON types.


1 Answers

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

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

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

Optional:

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

like image 86
Programmer Avatar answered Oct 01 '22 19:10

Programmer