Hello, I have a project that used the legacy analytics. In February 1, 2024 Unity stopped support.
So, I removed old stuff and did the new Unity Analytics setup. But I can’t get any data in my dashboard.
I tested the game on Android and no data is showing up in the dashboard or in Event Browser.
I have the correct project selected in Project Settings → Services.
In the editor in Analytics Debug Panel all events and uploads show up correctly.
This script runs at the start of the game:
using System.Collections;
using System.Collections.Generic;
using Unity.Services.Analytics;
using Unity.Services.Core;
using UnityEngine;
using UnityEngine.Analytics;
using UnityEngine.UI;
public class UGS_Start : MonoBehaviour
{
[SerializeField] private Text analyticsText;
public static UGS_Start instance;
async void Start()
{
if (instance == null)
{
instance = this;
}
else
{
Destroy(gameObject);
}
DontDestroyOnLoad(gameObject);
try
{
await UnityServices.InitializeAsync();
AnalyticsService.Instance.StartDataCollection();
if (UnityServices.State == ServicesInitializationState.Initialized)
{
Debug.Log("Initialized Unity Analytics");
analyticsText.text = "on";
}
else
{
Debug.Log("Not Intialized");
analyticsText.text = "else";
}
}
catch (System.Exception ex)
{
Debug.Log("Failed to initialize Unity Analytics {ex.Message}");
analyticsText.text = "exce";
}
AnalyticsService.Instance.RecordEvent("test_ev");
AnalyticsService.Instance.Flush();
}
}