Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

2021.1.22f1 WebGL deployments no longer work with JSON.net

Discussion in 'WebGL' started by salqadri, Sep 23, 2021.

  1. salqadri

    salqadri

    Joined:
    Nov 1, 2013
    Posts:
    7
    I upgraded from 2021.1.21f1 to 2021.1.22f1 and after doing so I am no longer able to build for WebGL. I downgraded back to 2021.1.21f1 and it worked fine.

    Here is the error I get on 2021.1.22f:

    ArgumentException: The Assembly UnityEngine is referenced by Newtonsoft.Json ('Assets/JsonDotNet/Assemblies/AOT/Newtonsoft.Json.dll'). But the dll is not allowed to be included or could not be found.
    UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1[T] alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2[TKey,TValue] cache, UnityEditor.BuildTarget target) (at <33fb8f3984d146e083d756d969c06738>:0)
    UnityEditor.AssemblyHelper.AddReferencedAssembliesRecurse (System.String assemblyPath, System.Collections.Generic.List`1[T] alreadyFoundAssemblies, System.String[] allAssemblyPaths, System.String[] foldersToSearch, System.Collections.Generic.Dictionary`2[TKey,TValue] cache, UnityEditor.BuildTarget target) (at <33fb8f3984d146e083d756d969c06738>:0)
    UnityEditor.AssemblyHelper.FindAssembliesReferencedBy (System.String[] paths, System.String[] foldersToSearch, UnityEditor.BuildTarget target) (at <33fb8f3984d146e083d756d969c06738>:0)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()


    I am using the JSON.net asset from the store (https://assetstore.unity.com/packages/tools/input-management/json-net-for-unity-11347). It worked great until this new version of Unity.
     
  2. CodeStarrk

    CodeStarrk

    Joined:
    Jan 5, 2017
    Posts:
    37
    Go to Build Settings -> Player Settings -> API Compatibility level set that to .NET 2.0
     
  3. salqadri

    salqadri

    Joined:
    Nov 1, 2013
    Posts:
    7
    I already have it at that, thanks. I'm still facing the issue.
     
    Last edited: Sep 24, 2021
  4. CodeStarrk

    CodeStarrk

    Joined:
    Jan 5, 2017
    Posts:
    37
    Usually if you upgraded unity version to a version with very very minor updates (the diff between versions is xxxx.x.x1 to xxxx.x.x2) that means it's a Unity problem and you'll just have to upgrade to another version, has happened to me many times with WebGL, I kept down and upgrading versions till I found the perfect version