Example #1
0
        public static bool SendUIUsageModeEvent(UIUsageMode uiUsageMode, float durationInSeconds)
        {
            if (!s_EnableAnalytics)
            {
                return(false);
            }

#if UNITY_2018_1_OR_NEWER
            // Duration is in "ticks" 100 nanosecond intervals. I.e. 0.1 microseconds
            float durationInTicks = SecondsToTicks(durationInSeconds);

            ProfileAnalyzerUIUsageEvent uiUsageEvent;
            switch (uiUsageMode)
            {
            case UIUsageMode.Single:
                uiUsageEvent = new ProfileAnalyzerUIUsageEvent("profileAnalyzerSingle", durationInTicks);
                break;

            case UIUsageMode.Comparison:
                uiUsageEvent = new ProfileAnalyzerUIUsageEvent("profileAnalyzerCompare", durationInTicks);
                break;

            default:
                Debug.LogFormat("SendUsageEvent: Unsupported usage mode : {0}", uiUsageMode);
                return(false);
            }


            AnalyticsResult result = EditorAnalytics.SendEventWithLimit(k_EventTopicName, uiUsageEvent);
            if (result != AnalyticsResult.Ok)
            {
                return(false);
            }

            return(true);
#else
            return(false);
#endif
        }
Example #2
0
 static public void SendUIUsageModeEvent(UIUsageMode uiUsageMode, Analytic instance)
 {
     instance.End();
     SendUIUsageModeEvent(uiUsageMode, instance.GetDurationInSeconds());
 }