Search Unity

Bug [Unity Analytics 3.4.0] Analytics.asmdef will not be compiled

Discussion in 'Editor & General Support' started by Yanka33, Jun 14, 2020.

  1. Yanka33

    Yanka33

    Joined:
    Oct 12, 2015
    Posts:
    10
    Hi there,

    I hope I am writing this post at the right place :)

    I have built some custom packages to help with game developments, declaring proper Assemblies as required by the PackageManager, and some of them have a dependency to the Unity Analytics package, and more specifically to the struct AdvertisingNetwork.

    My first problem was that, as I used the Unity Analytics package version 3.3.5 (the verified version for Unity 2019.4), there was no asmdef file to use as a reference for the dependencies of my packages' Assemblies.

    So I tried to update the Unity Analytics package to the last version 3.4.0, and I was happy to find an Analytics.asmdef file in the StandardEvents folder, meaning that I would be able to reference it as a dependency of my own Assemblies!
    However, a quick look in the console makes all my hopes to vanish:

    Code (CSharp):
    1. Assembly for Assembly Definition File 'Packages/com.unity.analytics/AnalyticsStandardEvents/Analytics.asmdef' will not be compiled, because it has no scripts associated with it.
    2. UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget)
    And thus, as I feared, referencing this asmdef revealed to be useless, causing my packages not to compile because they couldn't find any declaration for the struct AdvertsingNetwork.

    So I have a double question/
    - Is is possible to quickly fix this issue in the Unity Analytics package in order to have some proper Assemblies to reference if needed?
    - In the meanwhile, do I have any other option to declare the dependency between my custom packages' Assemblies and Unity Analytics?

    Thanks for the help!
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Do you want to reference the Analytics package in your asmdef?

    It doesn't matter if the package uses asmdefs or dlls, both will work.
    To use a dll click the override references option and add them to the Assembly References like so:
    Screen Shot 2020-06-14 at 16.03.43.png
    You can even add a define so it can be optional
    Screen Shot 2020-06-14 at 16.03.48.png
     
  3. Yanka33

    Yanka33

    Joined:
    Oct 12, 2015
    Posts:
    10
    Thank you for the answer.
    Unfortunately, referencing the DLLs is not working either. Upon building, another error message appears saying that the DLL cannot be included or is not present.

    However, the solution to my problem was much easier and kind of dumb: I forgot to activate the Analytics service for the project... After doing so, it is not even necessary to manually declare the dependencies (I don't really understand why though, an explanation would be welcomed :) )

    Nonetheless, it brings me to another point: it would be nice that the Analytics package prints a warning or an error in the console if the package has been imported in the project but the service is not activated.
     
    karl_jones likes this.