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. Dismiss Notice

Bug 'AotHelper' compilation error when installing Unity Services packages

Discussion in 'Package Manager' started by nom4d, Jul 22, 2023.

  1. nom4d

    nom4d

    Joined:
    Oct 11, 2018
    Posts:
    5
    Hello,

    I have tried to install both the In App Purchases services package, and the Analytics services package. Each one has given me the compilation error regarding 'AotHelper'.


    Library/PackageCache/com.unity.services.core@1.10.1/Runtime/Telemetry/Handlers/MetricsHandler.cs(21,13): error CS0103: The name 'AotHelper' does not exist in the current context


    I have reimported all my packages, updated my version of Unity to 2022.3.5f1, not sure what else to do. If I understand AotHelper is included with the built in NewtonSoft package, so I can't really touch or modify that.
    What do I need to do to use these services packages?
     
  2. Adrian

    Adrian

    Joined:
    Apr 5, 2008
    Posts:
    1,051
    AotHelper is specific to the "Newtonsoft.Json-for-Unity" fork of Json.Net and not part of the upstream general Json.Net. You likely have multiple copies of "Newtonsoft.Json.dll" in your project, Unity's own version and an upstream Json.Net version, and only one of them can be used. Which one gets used is undefined and essentially random, you should get a warning in the Console, though.

    You'll have to find the duplicate upstream versions and remove them, ideally you should only have the DLLs from the "com.unity.nuget.newtonsoft-json" package in your project. Search your Assets, Packages and Library/PackageCache folders for "Newtonsoft.Json.dll" to see which packages/plugins have it bundled, then either update the dependency or modify it to not include the DLL – you might have to add a reference to Unity's package instead.
     
    nom4d and Saillot like this.
  3. nom4d

    nom4d

    Joined:
    Oct 11, 2018
    Posts:
    5
    Thank you, this solved my issue! I appreciate the help, hopefully this can solve the problem for anyone else that might have it as well.
     
    silentslack likes this.