Search Unity

Custom Event OnApplicationPause

Discussion in 'Unity Analytics' started by perpetualLicenses, May 31, 2019.

  1. perpetualLicenses

    perpetualLicenses

    Joined:
    Oct 3, 2018
    Posts:
    1
    I've discovered this post that was 2 years ago:
    https://forum.unity.com/threads/cant-send-in-ondestroy-or-onapplicationquit.296657/#post-3192566
    about events can be sent in any of the following places without issue (in Unity 5.4+).

    But i notice that my custom events send through OnApplicationPause(true) is unreliable.
    Sometimes it happens sometime it doesn't. I noticed it is always the last (true)'s custom event is not recorded in analytics.

    Anyone encounter something similar?

    I'm creating a custom event marker to record the Start time of my app and End time of my app. So that way i can also have the session length for each session.

    So it goes something like this:

    OnApplicationPause(bool status)
    if (status) //If app is paused
    {
    Custom Event End​
    }

    if (!Status) //If app is not paused
    {
    Custom Event Start​
    }
     
    Last edited: May 31, 2019
  2. JeffDUnity3D

    JeffDUnity3D

    Joined:
    May 2, 2017
    Posts:
    14,446