Importing into Unity2021.3.22f1 causes Compiler Errors: Namespace Netwonsoft could not be found
zongo811 opened this issue · 7 comments
I just upgraded to Unity 2021.3.9f1 to 2021.3.22f1 and had suddenly a lot of compile errors in LootLocker. The same happened when importing LootLocker from the Asset Store into my project:
It seems the Newtonsoft-Library is no longer available in Unity, it should be supplied with your project.
To reproduce:
- Create a new project in Unity 2021.3.22f1.
- Import LootLocker from the Asset Store
Can you give me a workaround?
Found a workaround. Unity 2021.3.22f1 does not provide "Newtonsoft" anymore, in contrast to lower versions.
To install it manually, in Visual Studio use "Extras > NuGet-Paket-Manager".
Look for "Newtonsoft.Json" and install a fitting version (for me it's currently 13.0.3).
This will create a folder named "Package" in your project.
From "\Packages\Newtonsoft.Json.13.0.3\lib\netstandard2.0" copy "Newtonsoft.Json.dll" and "Newtonsoft.Json.xml" to your Assets-Folder. I put them into "Assets\Plugins\Newtonsoft".
Go back to Unity, which will recompile your scripts. The compile errors should be gone by now.
@kirre-bylund
Could you include the dll in your Asset or provide an additional Asset with these files in case the namespace "Newtonsoft" is not provided? I did not check on Unity 2022 or higher, but I guess the same problem will arise with these versions.
Thank you for your report, this is a known issue. A simpler workaround for you is to use the Unity package manager > Add package by name > "com.unity.nuget.newtonsoft-json" & version 3.0.2.
Regardless, this problem will be fixed in the next release of the Unity SDK. We just merged a PR to switch out the dependency to Unity.Plastic.Newtonsoft.
I have the same exact problem as @davidtopping02.
I have the same exact problem as @davidtopping02.
hey so the workaround I used was
-> create an externals folder in the unity package and close the plug-in on it . so i can edit it.
-> got the version of newtonsoft package using the package manager.
-> edited the using statements to use the newtonsoft package statements rather than the unity.newtonsoft namespace
I have the same exact problem as @davidtopping02.
hey so the workaround I used was -> create an externals folder in the unity package and close the plug-in on it . so i can edit it. -> got the version of newtonsoft package using the package manager. -> edited the using statements to use the newtonsoft package statements rather than the unity.newtonsoft namespace
Thanks it worked!!!
We have just released v1.2.0 of the Unity SDK that fixes these build errors: https://github.com/LootLocker/unity-sdk/releases/tag/v1.2.0