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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question Conflict with existing Newtonsoft.JSON package

Discussion in 'Unity Remote Config' started by liortal, Jul 29, 2020.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,532
    We already have Newtonsoft.Json in our project, when adding "Remote config" from the UPM UI, i am getting conflicts on all types from Newtonsoft.Json since we already have it, and the package references another copy of it as well.

    I could only find 1 post in this forum regarding this issue: https://forum.unity.com/threads/dependency-on-newtonsoft-json.814128/#post-5398014

    Any way to easily work around this issue ?
     
  2. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
  3. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,532
    I have Newtonsoft.JSON for a long time in our project. It was imported as a UnityPackage from the asset store.
    It is located in some folder in our project.

    When importing the remote config package, i am getting conflicts.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please provide steps to reproduce on a new project and the URL of the asset to use.
     
  5. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,532
    I reported this as a bug so i can include our copy of JSON.NET (didn't want to share it here).

    (Case 1268302) Remote config package conflicts with Newtonsoft.JSON
     
  6. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you elaborate, your copy? Where did you install it from, did you modify it? I read the bug report, but I need steps to reproduce on a new project.
     
  7. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,532
    Our project is running for a few years now, we installed it from the asset store (bought it).

    The location is not the original one, and we didnt modify it.
     
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you provide the Asset Store link? Sorry I didn't follow what you meant by original location
     
  9. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,532
  10. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
  11. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,532
    We are using Unity 2018.4.

    What do you mean by fully qualified namespace? u mean modify our version of JSON.NET to make its namespace different from the one Unity is using?

    I think the other way around is better - Unity should modify the package. Don't make me do the hard work myself...
     
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    No, when you make the call, put in the fully qualified name of the method, with the namespace. Yes, we will look into it, you would need to wait for a future release however. Please show your Using statement, and a representative method call. I'll show you how to add the FQN.
     
  13. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,532
    the fully qualified name will not work. it's not the call that is problematic, its the fact that the same classes are being compiled twice in 2 separate assemblies, which is not possible.

    Is there any workaround for this so we can try remote config? so far i haven't found one.
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    It is suggested that you remove one Newtonsoft or the other (the Newtonsoft package in Remote Config OR the existing one in the project), and then re-point the broken references to the version you choose to keep
     
  15. NaveenThomas

    NaveenThomas

    Joined:
    Jun 23, 2020
    Posts:
    2
    Hey guys,
    I wont be able to remove the existing Newtonsoft in the project and I just couldn't figure out how to remove the Newtonsoft from remote config. Is there a way to remove the Newtonsoft that is getting added because of adding the remote config package ?

    Thanks,
    Naveen Thomas
     
  16. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Can you provide additional details? Why are you not able to remove the existing package? Once I have a few more details, I can check with engineering. Perhaps share some screenshots and any errors that you receive.
     
  17. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    829
    Remote Config shouldn't ship with its own copy of Newtonsoft (a very common library used by many teams) - it should declare a dependency on the hosted Newtonsoft package, so that teams can use that package the same way Remote Config uses that package, assuming it should use something as heavy as Newtonsoft at all!

    Why can't remote config use the built in JsonUtility from Unity itself? Because it's too primitive? If so, that's why many games already have the full Newtonsoft project in their projects, and you will run into this conflict repeatedly. Maybe JsonUtility should be improved.

    Either way, bundling your own *copy* of something many teams already have is inviting conflicts just as @liortal reported here.
     
  18. NaveenThomas

    NaveenThomas

    Joined:
    Jun 23, 2020
    Posts:
    2
    Hey Jeff,

    It's not that we cant remove the existing Newtonsoft, Its just that we wish we had an option to remove the newly added Newtonsoft from RemoteConfig.

    The existing Newtonsoft that we have in the project is part of our framework and we would not want to remove that at this point of time in our development. It will be great if we can remove the new Newtonsoft that gets added to the project again when we are experimenting with the RemoteConfig.

    Thanks,
    Naveen Thomas
     
  19. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    Understood on the concerns mentioned here, it makes sense. I will pass this along to engineering.
     
    NaveenThomas likes this.
  20. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,532
    any update on this?
     
  21. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    No, I've mentioned it a few times here