Search Unity

Question How to disable Unity Analytics debug logging in release builds?

Discussion in 'Unity Analytics' started by levi9000, Oct 30, 2022.

  1. levi9000

    levi9000

    Joined:
    Jan 25, 2014
    Posts:
    11
    Every single Unity Analytics event writes out 2 logs with stack traces, one for "Recorded event," one for "
    Serializing event," and then for every batch of events there are 2 more logs, "Uploading events..." and "Events uploaded successfully!" When trying to analyze a player's log files, I have to spend a few minutes removing all those events from the logs so I can see what's actually going on.

    Is there any way to disable the unity analytics event logging in a release build? I couldn't find anything in the documentation.

    It's very much not important that those events show up in the logs as there is no detail other than the event name anyway (Ah, yes I see you "usedItem" 300 times), and I'd rather not waste the CPU time decoding the stack trace and writing to the log file, especially on mobile devices.
     
  2. SebT_Unity

    SebT_Unity

    Unity Technologies

    Joined:
    Jun 21, 2021
    Posts:
    282
    Hi @zephlabs,
    Thanks for posting on the forums!

    You must remove the UNITY_ANALYTICS_EVENT_LOGS when it is time to release your game.

    1. Go to Project Settings > Player Settings > Player.
    2. Go to Script Compilation section > Scripting Define Symbols.
    3. Remove keyword UNITY_ANALYTICS_EVENT_LOGS.
    4. Click Apply.

    More info can be found here: https://docs.unity.com/analytics/Debugging.html

    All the best,
    Seb
     
  3. levi9000

    levi9000

    Joined:
    Jan 25, 2014
    Posts:
    11
    AHHHHH, thank you! I was too busy looking for a setting or function in the SDK.
     
    SebT_Unity likes this.