Re-enable the JsonDotNet dll to avoid common errors. #794
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Quite a few JsonDotNet errors have popped up on discord and github recently.
This is because of a change in Unity packages that come included in recent Unity versions.
It all comes down to
Assets\FlutterUnityIntegration\JsonDotNet\Assemblies\AOT\Newtonsoft.Json.dll.txt
Unity 2019 and 2020 versions needed the dll to be included in the assets folder.
Early Unity 2021 and 2022 versions gave duplicate import errors because of default installed packages (usually collab / version control)
To avoid this error the
.dll
file was renamed to.dll.txt
, to stop Unity from importing it.Now the latest 2021 and 2022 versions have returned to the old behaviour of needing the dll.
An alternative of including the ddl is having users manually install it from the package manager.
Error messages
Error 1: when the .dll is missing but needed
Error 2: when the .dll is included but redundant
Test
I ran a test importing the unitypackage in a new unity project (without any package manager changes).
This is the out of the box experience for a new user.
It seems like only the early to middle versions of Unity 2021 and 2022 use a Version Control package that includes a conflicting Newtonsoft package.
The latest versions have removed the dependency, just like 2019 and 2020 before.
if some users do have to get an error, error 2 seems easier to solve based on the provided message.
Changes
.dll
to re-enable the import.In the future this should propbably be resolved by publishing a UPM package with dependencies.
But this should give a smoother setup for now.
Type of Change