Search Unity

Resolved Analytics Beta CustomEvents Works In Editor only

Discussion in 'Unity Gaming Services General Discussion' started by Venros, Apr 24, 2022.

  1. Venros

    Venros

    Joined:
    Nov 12, 2015
    Posts:
    11
    I have 2 environments setup and both work correctly while in editor, but for some reason certain events never get sent on Android. Not sure if this is a permissions issue or there is some setting missing. I verified this using the event browser, here is the init snippet:


    Code (CSharp):
    1.   public class AnalyticsManager : Singleton<AnalyticsManager>
    2.   {
    3.     // Start is called before the first frame update
    4.     async void Start()
    5.     {
    6. #if DEVELOPMENT_BUILD || UNITY_EDITOR
    7.       var options = new InitializationOptions().SetOption("com.unity.services.core.environment-name", "development");
    8. #else
    9.      var options = new InitializationOptions().SetOption("com.unity.services.core.environment-name", "production");
    10. #endif
    11.       await UnityServices.InitializeAsync(options);
    12.     }
    13. }
    Mind you the sdk events such as gameStarted/Ended, etc all work correctly on device.
     
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please share the code you are using for custom events. Place Debug.Log statements throughout your code to troubleshoot, they will show in the Android logcat logs https://forum.unity.com/threads/how-to-capturing-device-logs-on-android.528680/ and https://forum.unity.com/threads/tips-for-new-unity-users.701864/#post-5057741
     
  3. Venros

    Venros

    Joined:
    Nov 12, 2015
    Posts:
    11
    The code is as simple as the following:

    Code (CSharp):
    1. Events.CustomData("ScreenState", new Dictionary<string, object> { { "ScreenName", "MainMenu" }, { "FromScreen", "LandingScene" } });
    Enabled UNITY_ANALYTICS_EVENT_LOGS and verified that the correct events are registered, but non show up on the data browser/explorer. Anything specific I should be looking for?

    EDIT:
    I get the following error code 400:

    Code (CSharp):
    1. 04-25 16:04:01.103: I/Unity(7863): Uploading events...
    2. 04-25 16:04:01.525: I/Unity(7863): Events failed to upload (code 400) -- will retry at next heartbeat.
     
  4. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446
    Please test with the latest release 4.0.0-pre.2. We made improvements in this area. If you continue to have issues, please provide a Charles Proxy capture if you can https://support.unity.com/hc/en-us/articles/115002917683-Using-Charles-Proxy-with-Unity
     
  5. Venros

    Venros

    Joined:
    Nov 12, 2015
    Posts:
    11
    JeffDUnity3D likes this.