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

Question com.unity.collections dependency to Unity Analytics

Discussion in 'C# Job System' started by KimmoFactor, Oct 5, 2023 at 9:04 AM.

  1. KimmoFactor

    KimmoFactor

    Joined:
    Dec 29, 2020
    Posts:
    37
    Not sure if this is the correct place for this, but I'm using com.unity.collections (2.1.4) and jobs, but I don't understand why the collections package has a dependency to "Unity Analytics". I want to disable that built-in package, but I can't because of collections. Nothing else in my project has that dependency.

    So my question is, is there a real reason for that dependency or can you maybe remove it in a future update? I'm sure it's harmless I guess, but I would prefer not to have the analytics package anywhere near my project and otherwise like to run as slim of a configuration as I can too.
     
    CodeSmile and DevDunk like this.
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    3,721
    I noticed that too only yesterday. Probably an oversight.

    Sometimes the IDE puts references to assemblies in there because Not-So-Intellisense thinks you'd rather want to use, for example, System.Random or something in System.Cryptography just because the class names are the same or identical to a Unity class. And when that happens, the dependency may be added automatically to the assembly definition but doesn't get removed automatically once you stop using that dependency in code.

    In the meantime until this is fixed, you could copy the package contents to the Assets tree, remove the package from Package Manager, and then modify whatever Assembly Definition references Analytics by removing it from the dependencies and possibly commenting out some of the code that uses Analytics.
     
  3. Spy-Master

    Spy-Master

    Joined:
    Aug 4, 2022
    Posts:
    260
    That only really concerns assembly definitions, and really wouldn't account for the dependency being present in the package manifest, which is what was mentioned here.

    The analytics module's usages (in Unity.Collections/Telemetry.cs) are guarded behind UNITY_EDITOR && ENABLE_CLOUD_SERVICES_ANALYTICS, so it shouldn't apply to player builds. With that said, it would be trivial for the developers to add a version define to the assembly for the analytics module and then not require the module be present.
     
    KimmoFactor likes this.