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.

Bug Analytics Parameterless CustomData Throws Silent Error

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

  1. Vandarthul


    Dec 23, 2012
    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: 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:
    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/
  2. Laurie-Unity


    Unity Technologies

    Mar 5, 2020
    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.

    Vandarthul likes this.