Analytics can't uploading

Hi ,In my PC project, I send the event , console always display Serializing event gameRunning for dispatch… or Serializing event xxxxx for dispatch…, then don’t display uploading and success msg.

When I create the new project and try this, all it’s fine, so I can’t find the problem.

I know analytics will auto Flush, so I didn’t write in my code.

I guess maybe I used the plugin : Desktop Mascot Maker.

Unity Version : 2020.3.21f1
Analytics Version : 4.2.0

async void Start()
    {
        try
        {
            await UnityServices.InitializeAsync();
            List<string> consentIdentifiers = await AnalyticsService.Instance.CheckForRequiredConsents();
        }
        catch (ConsentCheckException e)
        {
            Debug.LogError("Error " + e.Reason.ToString());
        }
    }
public static void SendEvent(string _accountID, string _achievementType, int _count)
        {
            Dictionary<string, object> data = new Dictionary<string, object>
            {
                { "accountID" , _accountID },
                { "achievementType" , _achievementType },
                { "count" , _count }
            };
            AnalyticsService.Instance.CustomData(_achievementType, data);
            Debug.LogWarning("" + _accountID + " SendEvent : " + _achievementType + " , Count : " + _count + "");
        }

Hey DB, I will take a look at this and get back to you. Thanks for sharing the extra plugin, you never know!

Update: I wasn’t able to reproduce your issue, however, I did not add the Desktop Mascot Maker. I did read that the DMM overrides some of your Project Settings, and I’m guessing that it is mildly interfering with the link between your project and Unity Gaming Services. I’m assuming your test project did not have this installed? Would you mind trying to add this plugin to the test project that has Analytics sending appropriately, and getting back to me whether or not it works?

Thanks!
Randy

Hi Randy, thank you for response. I found something. No matter what I create the new project or new scene is fine. If I use the DMM script (Only this MascotMaker.cs), the problem will appear.
First, I turn off the script, then start to play, analytics is fine. The event can uploading and success. Then, I turn on the script, analytics can’t uploading. And the console haven’t any error log.

In this script, I check the Awake and test, until line 22, the problem will appear, Form.Show() will use System.Windows.Forms.Control.
System.Windows.Forms Version=4.0.0.0

        void Awake()
        {
            CheckInstance();

            if (mainWindowHandle == IntPtr.Zero)
            {
                System.Diagnostics.Process curProcess = System.Diagnostics.Process.GetCurrentProcess();

                //int processId = curProcess.Id;
                //Microsoft.VisualBasic.Interaction.AppActivate(processId);
                SetForegroundWindow(curProcess.Handle);

                mainWindowHandle = GetActiveWindow();
            }

            cam = transform.GetComponent<Camera>();
            rend = transform.GetComponent<Renderer>();

            cam.clearFlags = CameraClearFlags.SolidColor;

            Form = new MascotForm();
            Form.Show();

            //    formDummy = new Form();
            //    formDummy.FormBorderStyle = FormBorderStyle.None;
            //    formDummy.Opacity = 0.0;
            //    formDummy.Show();
            //    Invoke("closeDummy", 0.01f);

            //    if (PlayOnAwake)
            //    {
            //        isRender = true;
            //    }
            //    else
            //    {
            //        isRender = false;
            //        Form.Hide();
            //    }

            //    mascotMakerMaterial = (Material)Resources.Load("MascotMakerMaterial", typeof(Material));
            //    Debug.Assert(mascotMakerMaterial != null, "mascotMakerMaterial is not found!", transform);

            //    mascotMakerMaterialChromakey = (Material)Resources.Load("MascotMakerMaterialChromakey", typeof(Material));
            //    Debug.Assert(mascotMakerMaterialChromakey != null, "MascotMakerMaterialChromakey is not found!", transform);

            //    mascotMakerTexture = new RenderTexture((int)MascotFormSize.x, (int)MascotFormSize.y, 24, RenderTextureFormat.ARGB32);
            //    Debug.Assert(mascotMakerTexture != null, "MascotMakerTexture is not found!", transform);

            //    mascotMakerTexture.antiAliasing = (int)AntiAliasing;
            //    mascotFormSizePre = MascotFormSize;
            //    antiAliasingPre = AntiAliasing;

            //    ChromaKeyColor = new UnityEngine.Color(ChromaKeyColor.r, ChromaKeyColor.g, ChromaKeyColor.b, 0.0f);
            //    cam.backgroundColor = new UnityEngine.Color(ChromaKeyColor.r, ChromaKeyColor.g, ChromaKeyColor.b, 0.0f);
            //    mascotMakerMaterialChromakey.color = new UnityEngine.Color(ChromaKeyColor.r, ChromaKeyColor.g, ChromaKeyColor.b, 0.0f);

            //    ChromaKeyRange = Mathf.Clamp(ChromaKeyRange, 0.002f, 1.0f);
            //    chromaKeyRangePre = ChromaKeyRange;
            //    mascotMakerMaterialChromakey.SetFloat("_Amount", chromaKeyRangePre);

            //    if (ChromaKeyCompositing)
            //    {
            //        rend.material = mascotMakerMaterialChromakey;
            //    }
            //    else
            //    {
            //        rend.material = mascotMakerMaterial;
            //    }

            //    rend.sharedMaterial.mainTexture = mascotMakerTexture;

            //    cameraTexture = new Texture2D(mascotMakerTexture.width, mascotMakerTexture.height, TextureFormat.ARGB32, false);

            //    cam.targetTexture = mascotMakerTexture;

            //    CvSize size = new CvSize(mascotMakerTexture.width, mascotMakerTexture.height);
            //    img = Cv.CreateImage(size, BitDepth.U8, 4);

            //    scaleVector = new Vector3(1.0f, -1.0f, 1.0f);

            //    isMouseHover = false;

            //    Form._LeftMouseDown += LeftMouseDown;

            //    Form._LeftMouseUp += LeftMouseUp;
            //    Form._RightMouseUp += RightMouseUp;
            //    Form._MiddleMouseUp += MiddleMouseUp;

            //    offsetX = 0;
            //    offsetY = 0;
            //    isLeftMouseDown = false;

            //    frameColor = new CvScalar(255, 0, 0, 128);
        }

Perfect, thank you for testing that. Unfortunately, it means that you will not be able to combine that script (and likely the whole plugin) with Unity Analytics (and potentially any Unity Gaming Services) unless you find a way to work around the issue. You might be able to contact the creator of the plugin to troubleshoot it with them or at least identify the issue.

I wish I could help!
Randy

Okay, thank a lot.