Search Unity

Bug Analytics Parameterless CustomData Throws Silent Error

Discussion in 'Unity Analytics' started by Vandarthul, Sep 22, 2022.

  1. Vandarthul

    Vandarthul

    Joined:
    Dec 23, 2012
    Posts:
    20
    Hi,
    Using this line code
    Code (CSharp):
    1. Unity.Services.Analytics.AnalyticsService.Instance.CustomData("anyEvent", null);
    Stops code execution without giving any error. The method expects
    Code (CSharp):
    1.  new Dictionary<string, object>()
    but the problem is this information can only be found somewhere in the forums. There are no example of parameterless CustomData usage in docs: https://docs.unity.com/analytics/UnityAnalytics.html(here I also would like to state that your docs contains a lot more dead links than it should but that is a whole different story) or in example unity services github repo: https://github.com/Unity-Technologies/com.unity.services.samples.use-cases.
    I don't think it is convenient/common sense to create an empty dictionary just to send parameterless event. I also don't think making public API's that just silently stops the execution is a way to go. After I discover the issue, I took the line inside try/catch block just to see the error:
    Code (CSharp):
    1. System.NullReferenceException: Object reference not set to an instance of an object
    2.   at Unity.Services.Analytics.AnalyticsServiceInstance.CustomData (System.String eventName, System.Collections.Generic.IDictionary`2[TKey,TValue] eventParams) [0x00024] in /PackageCache/com.unity.services.analytics@4.0.1/Runtime/Events/AnalyticsServiceInstance.CustomData.cs:18
     
  2. Laurie-Unity

    Laurie-Unity

    Unity Technologies

    Joined:
    Mar 5, 2020
    Posts:
    220
    Hi there,

    Thanks for sharing your feedback with us, we really value it. We are hard at work making improvements to the services and adding additional functionality.

    I've added both your points to the list and hope we will be able to make the necessary imporvements.

    Please feel free to share any other feedback or observations on your experience with UGS.

    Thanks
     
    Vandarthul likes this.