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.

Discussion Unity new analytics SDK increases build size by ~9MB

Discussion in 'Unity Analytics' started by wanted748, Aug 8, 2022.

  1. wanted748

    wanted748

    Joined:
    Mar 11, 2018
    Posts:
    10
    I recently tried ingenerating the new unity analytics SDK form the package manager and realized that upon building the player the apk size was increased by approx 9MB. Upon further analysis I found out that the size was being taken up by the libunity.so file as the SDK added a lot of code? Is it supposed to happen? If so, then does it mean I have to find a way to be okay with it If I want to keep using analytics in my production games? Thank you
     
  2. Julian-Unity3D

    Julian-Unity3D

    Unity Technologies

    Joined:
    Apr 28, 2022
    Posts:
    104
    Hello,

    As with any app or game that you build you should consider optimization techniques to keep the file size down as this will help improve number of downloads.

    I highly suggest you take a look at the Unity - Manual: Reducing the file size of your build (unity3d.com) this will guide you in some best techniques to reduce the build size.

    I would like to note however, that any SDK being used in any project will increase the file size of the build. But with some optimization within your project you can further reduce the build size.
     
  3. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    I tested this scenario and did not see any significant APK file size increase. Please provide a zip file of the project where you see this behavior. Remove the /Library folder before zipping to reduce file size.
     
  4. wanted748

    wanted748

    Joined:
    Mar 11, 2018
    Posts:
    10
    There you go.
    * Build the APK
    * Remove the analytics package and the dummy analytics script
    * Build the APK again
    * Compare the size

    Unity Version Used : Untiy 2021.3.5f1 LTS
    Il2CPP with both the x86 and x64 checked

    Size without the Analytics SDK -> 12.8 MB
    Size with the Analytics SDK -> 22.4 MB
     

    Attached Files:

  5. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    It appears that you did not remove the /Library folder and you actually have a project inside another project. You are also using the legacy Analytics library and not UGS Analytics. In Package Manager, you look for "Analytics" and not "Analytics Library" (legacy). If you don't see it, then add the package by Name (+ sign in the top left corner) and add com.unity.services.analytics
     
  6. wanted748

    wanted748

    Joined:
    Mar 11, 2018
    Posts:
    10
    First of all I haven't included the Library folder and secondly, I don't have a project inside another project. The path to the project is (AnalyticsTest/AnalyticsTest/{Project}). I'm using the UGS Analytics 4.0.1, you can check it in the package manager. I wonder if you have actually opened my project. I'm using the "using Unity.Services.Analytics" namespace and not the "using Unity.Analytics.

    1.PNG 2.PNG 3.PNG
     
  7. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    There's a chance I already had AnalyticsTest as a project and I unzipped yours inside it. Sorry if so, let me try again.
     
  8. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    @wanted748 I was able to reproduce, I indeed unzipped inside a local project of the same name. Sorry about that. Also, in a previous test, I believe I was compiling with Mono, I used IL2CPP this time. The APK size went from 13Mb to 23Mb after adding Analytics and the small script. I will let the team know and get their feedback and will update here.
     
  9. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    I wanted to provide an update. After checking with the team, this looks like it is expected. UGS Analytics has core dependencies that add up to the size increase that you are seeing.
     
  10. wanted748

    wanted748

    Joined:
    Mar 11, 2018
    Posts:
    10
    oh I see. Well thank you for the info :)
     
    Julian-Unity3D likes this.
  11. GlitchesHub

    GlitchesHub

    Joined:
    Aug 18, 2021
    Posts:
    2
    Any Update?
     
  12. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    No updates, currently this is expected behavior. I've asked the team a couple of times, but I'll keep trying!
     
    Julian-Unity3D likes this.
  13. GlitchesHub

    GlitchesHub

    Joined:
    Aug 18, 2021
    Posts:
    2
    what we use instead of this for Custom Events ? without increase that much size?
     
  14. JeffDUnity3D

    JeffDUnity3D

    Unity Technologies

    Joined:
    May 2, 2017
    Posts:
    14,446
    I don't have experience with other options, but a Google search for "mobile game custom events" brings up some suggestions. You could also write data to a remote database. Sorry I couldn't be of more help.
     
  15. akgames51

    akgames51

    Joined:
    Apr 19, 2018
    Posts:
    1
    @JeffDUnity3D any updates regarding new analytics size increase?