Search Unity

Resolved Analytics Custom Event doesnt work Unity 2020.3.34

Discussion in 'Unity Analytics' started by RajrjGohil, Jul 1, 2022.

  1. RajrjGohil

    RajrjGohil

    Joined:
    Aug 20, 2020
    Posts:
    4
    I have set up analytics and defined my custom Event
    userMovedFromMainMenu

    upload_2022-7-1_14-5-5.png



    I have made a function that fire's up the event but I am not able to see it in my event browser


    upload_2022-7-1_14-7-4.png
    Here is my code for the function :

    Code (CSharp):
    1.     private void EnterSession()
    2.     {
    3.         SceneIndexToBeLoaded = SceneIndex;
    4. #if ENABLE_CLOUD_SERVICES_ANALYTICS
    5.         Analytics.CustomEvent("userMovedFromMainMenu");
    6. #endif
    7.         SceneManager.LoadScene(1);
    8.     }
    Also i have Initialised UnityServices.InitializeAsync(); upload_2022-7-1_14-5-5.png upload_2022-7-1_14-7-4.png
     
  2. Laurie-Unity

    Laurie-Unity

    Unity Technologies

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

    Thanks for sharing the details of your issue.

    I can see from your screenshots that you have defined your userMovedFromMainMenu custom event in the new Unity Gaming Services Analytics UI.

    But the code snippet you shared is for the old Legacy Analytics system. Here's a link to the documentation for Recording Custom Events in the new UGS Analytics system.

    Your code should look more like

    Code (CSharp):
    1. Dictionary<string, object> parameters = new Dictionary<string, object>();
    2. AnalyticsService.Instance.CustomData("userMovedFromMainMenu", parameters);
    You will have to install the UGS Analytics package in the Package manager and include it in your code too.

    Code (CSharp):
    1. using Unity.Services.Analytics;
    If you are adding any additional parameters, for example the name of the scene the player is moving to, you will need to add them to your event definition in the Event Manager and to the parameters dictionary in your code.

    I hope that helps.
     
  3. RajrjGohil

    RajrjGohil

    Joined:
    Aug 20, 2020
    Posts:
    4
    Laurie-Unity likes this.
  4. RafalKaminski

    RafalKaminski

    Joined:
    Jul 4, 2022
    Posts:
    20
    Hey I'm having a similar problem. I'm using the 2019.4.29 unity version and the
    Using Unity.Services.core
    is not working for me I've been trying to find those packages you mentioned but they do not show in my manager? Is the version of the unity too old for this? How can I run the analytics on this version code-wise? I downloaded a sample scene from the Unity 2022 version and reuploaded it to the older one. Am I missing some package?
     
  5. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    What packages are you referring to, are you receiving an error? Where did you download a sample scene from 2022? Generally you do not want to downgrade Unity projects, downgrade is not supported. Please share a screenshot of the packages you have installed in Package Manager, you want the Analytics package.
     
  6. RafalKaminski

    RafalKaminski

    Joined:
    Jul 4, 2022
    Posts:
    20
    upload_2022-7-7_15-37-33.png

    I downloaded it from here from 2022.1.7f1

    upload_2022-7-7_15-38-24.png

    from the 2022 I reuploaded it to the 2019.4.29 version where the code stopped working due to the lack of Core Servieces package which I couldn't find.

    upload_2022-7-7_15-40-2.png
    No Unity.Services aren't working so my question is how Can I get Custom Events wired to the older engine so they reflect on the dashboard? Is it possible? Or what is the ,,oldest" version of Unity that this code works with? I'm having a project on older version and I'm looking for a way to connect it with the new analytics system.
     
  7. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
  8. RafalKaminski

    RafalKaminski

    Joined:
    Jul 4, 2022
    Posts:
    20
    So it's not possible to attach the old project to it yes? The code only works with newer version of the engines yes?
     
  9. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    You can upgrade projects, but don't downgrade. If you've copied anything directly into this project like you mentioned, you'll want to start over, or use a back up prior to copying. The code above does work with Unity 2019. But keep in mind that Unity 2019 is no longer supported (it still works, just no new bug fixes), you'll want to use a more recent version of Unity.
     
  10. RafalKaminski

    RafalKaminski

    Joined:
    Jul 4, 2022
    Posts:
    20
    ok that's what I wanted to hear that the code works with the 2019 thank you
     
    JeffDUnity3D likes this.
  11. RafalKaminski

    RafalKaminski

    Joined:
    Jul 4, 2022
    Posts:
    20
    upon further investigation I cannot see the 4.0.1 package in the Unity engine 2019.4.29 I found and information like this
    https://docs.unity.cn/2022.1/Documentation/Manual/com.unity.services.analytics.html
    that this package are available in Unity version 2022.1:

    So back to my question how can I link the project on 2019 engine without the 4.0.1 package since it's only supports 2022? Can I do it or do I need to upgrade the whole project to the newer version? Since it's not the only project I have on the older version I would like to know if I need to upgrade all of them to use analytics
     
    Last edited: Jul 7, 2022
  12. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please see my screenshot using Unity 2019.4.40 LTS, it is available for all Unity versions 2019.4 and above, not only 2022. Please show a wider screenshot of your Package Manager, it should be just above your mentioned Analytics Library. And yes, you should upgrade Unity. But get it working on a test project first to confirm. Always make a full project backup before doing any upgrade.
     
  13. RafalKaminski

    RafalKaminski

    Joined:
    Jul 4, 2022
    Posts:
    20
    upload_2022-7-7_16-50-8.png
    that's the view of my manager that's all I have from there
    upload_2022-7-7_16-50-41.png

    on the 4.29 version there is no such package I'm checking on the 4.40 version now. Ok this version have it. So it seems that I have to first update the project to new engine before connecting it to the dashboard
     
  14. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Yes, time to upgrade! At least to Unity 2019.4.40 LTS as mentioned.
     
  15. RafalKaminski

    RafalKaminski

    Joined:
    Jul 4, 2022
    Posts:
    20
    I will thank you for your help
     
    JeffDUnity3D likes this.