Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Analytics can't uploading

Discussion in 'Unity Analytics' started by DBDBDDBDBD, Nov 16, 2022.

  1. DBDBDDBDBD

    DBDBDDBDBD

    Joined:
    Jan 18, 2017
    Posts:
    10
    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


    Code (CSharp):
    1. async void Start()
    2.     {
    3.         try
    4.         {
    5.             await UnityServices.InitializeAsync();
    6.             List<string> consentIdentifiers = await AnalyticsService.Instance.CheckForRequiredConsents();
    7.         }
    8.         catch (ConsentCheckException e)
    9.         {
    10.             Debug.LogError("Error " + e.Reason.ToString());
    11.         }
    12.     }
    Code (CSharp):
    1. public static void SendEvent(string _accountID, string _achievementType, int _count)
    2.         {
    3.             Dictionary<string, object> data = new Dictionary<string, object>
    4.             {
    5.                 { "accountID" , _accountID },
    6.                 { "achievementType" , _achievementType },
    7.                 { "count" , _count }
    8.             };
    9.             AnalyticsService.Instance.CustomData(_achievementType, data);
    10.             Debug.LogWarning("" + _accountID + " SendEvent : " + _achievementType + " , Count : " + _count + "");
    11.         }
     
    Last edited: Nov 16, 2022
  2. RandolfKlemola

    RandolfKlemola

    Unity Technologies

    Joined:
    May 1, 2020
    Posts:
    127
    Hey DB, I will take a look at this and get back to you. Thanks for sharing the extra plugin, you never know!
     
  3. RandolfKlemola

    RandolfKlemola

    Unity Technologies

    Joined:
    May 1, 2020
    Posts:
    127
    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
     
  4. DBDBDDBDBD

    DBDBDDBDBD

    Joined:
    Jan 18, 2017
    Posts:
    10
    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

    Code (CSharp):
    1.         void Awake()
    2.         {
    3.             CheckInstance();
    4.  
    5.             if (mainWindowHandle == IntPtr.Zero)
    6.             {
    7.                 System.Diagnostics.Process curProcess = System.Diagnostics.Process.GetCurrentProcess();
    8.  
    9.                 //int processId = curProcess.Id;
    10.                 //Microsoft.VisualBasic.Interaction.AppActivate(processId);
    11.                 SetForegroundWindow(curProcess.Handle);
    12.  
    13.                 mainWindowHandle = GetActiveWindow();
    14.             }
    15.  
    16.             cam = transform.GetComponent<Camera>();
    17.             rend = transform.GetComponent<Renderer>();
    18.  
    19.             cam.clearFlags = CameraClearFlags.SolidColor;
    20.  
    21.             Form = new MascotForm();
    22.             Form.Show();
    23.  
    24.             //    formDummy = new Form();
    25.             //    formDummy.FormBorderStyle = FormBorderStyle.None;
    26.             //    formDummy.Opacity = 0.0;
    27.             //    formDummy.Show();
    28.             //    Invoke("closeDummy", 0.01f);
    29.  
    30.             //    if (PlayOnAwake)
    31.             //    {
    32.             //        isRender = true;
    33.             //    }
    34.             //    else
    35.             //    {
    36.             //        isRender = false;
    37.             //        Form.Hide();
    38.             //    }
    39.  
    40.             //    mascotMakerMaterial = (Material)Resources.Load("MascotMakerMaterial", typeof(Material));
    41.             //    Debug.Assert(mascotMakerMaterial != null, "mascotMakerMaterial is not found!", transform);
    42.  
    43.             //    mascotMakerMaterialChromakey = (Material)Resources.Load("MascotMakerMaterialChromakey", typeof(Material));
    44.             //    Debug.Assert(mascotMakerMaterialChromakey != null, "MascotMakerMaterialChromakey is not found!", transform);
    45.  
    46.             //    mascotMakerTexture = new RenderTexture((int)MascotFormSize.x, (int)MascotFormSize.y, 24, RenderTextureFormat.ARGB32);
    47.             //    Debug.Assert(mascotMakerTexture != null, "MascotMakerTexture is not found!", transform);
    48.  
    49.             //    mascotMakerTexture.antiAliasing = (int)AntiAliasing;
    50.             //    mascotFormSizePre = MascotFormSize;
    51.             //    antiAliasingPre = AntiAliasing;
    52.  
    53.             //    ChromaKeyColor = new UnityEngine.Color(ChromaKeyColor.r, ChromaKeyColor.g, ChromaKeyColor.b, 0.0f);
    54.             //    cam.backgroundColor = new UnityEngine.Color(ChromaKeyColor.r, ChromaKeyColor.g, ChromaKeyColor.b, 0.0f);
    55.             //    mascotMakerMaterialChromakey.color = new UnityEngine.Color(ChromaKeyColor.r, ChromaKeyColor.g, ChromaKeyColor.b, 0.0f);
    56.  
    57.             //    ChromaKeyRange = Mathf.Clamp(ChromaKeyRange, 0.002f, 1.0f);
    58.             //    chromaKeyRangePre = ChromaKeyRange;
    59.             //    mascotMakerMaterialChromakey.SetFloat("_Amount", chromaKeyRangePre);
    60.  
    61.             //    if (ChromaKeyCompositing)
    62.             //    {
    63.             //        rend.material = mascotMakerMaterialChromakey;
    64.             //    }
    65.             //    else
    66.             //    {
    67.             //        rend.material = mascotMakerMaterial;
    68.             //    }
    69.  
    70.             //    rend.sharedMaterial.mainTexture = mascotMakerTexture;
    71.  
    72.             //    cameraTexture = new Texture2D(mascotMakerTexture.width, mascotMakerTexture.height, TextureFormat.ARGB32, false);
    73.  
    74.             //    cam.targetTexture = mascotMakerTexture;
    75.  
    76.             //    CvSize size = new CvSize(mascotMakerTexture.width, mascotMakerTexture.height);
    77.             //    img = Cv.CreateImage(size, BitDepth.U8, 4);
    78.  
    79.             //    scaleVector = new Vector3(1.0f, -1.0f, 1.0f);
    80.  
    81.             //    isMouseHover = false;
    82.  
    83.             //    Form._LeftMouseDown += LeftMouseDown;
    84.  
    85.             //    Form._LeftMouseUp += LeftMouseUp;
    86.             //    Form._RightMouseUp += RightMouseUp;
    87.             //    Form._MiddleMouseUp += MiddleMouseUp;
    88.  
    89.             //    offsetX = 0;
    90.             //    offsetY = 0;
    91.             //    isLeftMouseDown = false;
    92.  
    93.             //    frameColor = new CvScalar(255, 0, 0, 128);
    94.         }
    95.  
     
    Last edited: Nov 17, 2022
  5. RandolfKlemola

    RandolfKlemola

    Unity Technologies

    Joined:
    May 1, 2020
    Posts:
    127
    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
     
  6. DBDBDDBDBD

    DBDBDDBDBD

    Joined:
    Jan 18, 2017
    Posts:
    10
    Okay, thank a lot.
     
    Last edited: Nov 18, 2022