Analytics Parameterless CustomData Throws Silent Error

Hi,
Using this line code Unity.Services.Analytics.AnalyticsService.Instance.CustomData("anyEvent", null);

Stops code execution without giving any error. The method expects 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:

System.NullReferenceException: Object reference not set to an instance of an object
  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

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

1 Like